[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] IO:: problems



Alan Fry <ajf@afco.demon.co.uk> writes:
}There does seem to be something curious about IO::File and IO::Handle.
}Using this droplet as a test:
}
}        use IO::File;
}        $f = shift;

Interestingly, with 5.13r2 on my 68030 Powerbook 165, shift fails to shift
ARGV.  I had to explicitly put $f = $ARGV[0] here.  Ah, well.

}        $fh = new IO::File;
}        $fh->open($f);
}        print <$fh>;
}
}works partially. If the name ends in a space (!) or <$fh->open($f, "r")>
}the error message "Read on closed filehandle <GENO>" results. However
}<$fh->open(">$f")> (etc.) seems to do what is expected.

I looked into this just now.  The Whitespace Protection Program swings into
effect only if you  use the multi-argument open method.  It's documented
this way, so I was wrong implying earlier that the protection is automatic
when you use IO::File.  The same is true of FileHandle in 5.13r2, and is
even more true in 5.14b2.  So whitespace at the end of a name will simply
get eaten by the open() that $fh->open eventually does, and it will fail.
Since you're using full paths with a droplet, whitespace on the beginning
of the file name is already protected.

$fh->open($f,"r") should and does (for me) protect whitespace at the end of
the filename.

}
}If "File" is replaced by "Handle" the error message "can't locate
}auto/IO/Handle/open.al in @INC" results in all cases.

Fixed documentation bug.  There was never an open method in IO::Handle, so
far as I know.

}
}Does anyone else get this?
}
}Alan Fry
}
}
}
}
}***** Want to unsubscribe from this list?
}***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch


--------
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693
Greenbelt, MD 20770
schinder@pjstoaster.pg.md.us


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch