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

Re: [MacPerl] IO:: problems



Paul Schinder wrote on  Thu, 18 Sep 1997 13:48:48 -0400

>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.

On a Powerbook 68030 running 7.5.1 and BigMacPerl 5.1.3r2 and on a PPC
running system 8 and MacPerl 5.1.4b2 'shift' on its own works, With a PPC
running 7.5.5 and MacPerl 5.1.3r2 it fails -- an explicit <shift @ARGV> is
necessary.

>}        $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.

Yes it does for me too with MacPerl 5.1.4b2 (system 8, PPC), but it fails
(as described above) with BigMacPerl 5.1.3r2 (on the 68K Powerbook) and
similarly with MacPerl 5.1.3r2 (on the PPC).

<$fh = new IO::File $f, "w"> etc. works (without brackets) using MacPerl
5.1.4b2 on a PPC but fails with BigMacPerl 5.1.3r2 on the 68K Powerbook.
The only construction that works there is <$fh = new IO::File($f)> --  <$fh
= new IO::File($f, "r")> fails also with a "no such file or directory"
error message.

>}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.

I should have looked to see if the sub was there, but I have such
unshakeable faith in podal infallibility it never crossed my mind...

Alan fry



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