develooper Front page | perl.perl5.porters | Postings from September 2014

Re: New feature proposal : <<>> to disable magic open of ARGV

Thread Previous | Thread Next
Father Chrysostomos
September 30, 2014 16:17
Re: New feature proposal : <<>> to disable magic open of ARGV
Message ID:
Rafael Garcia-Suarez wrote:
> > It looks as though you have changed the behaviour of eof(), though I
> > have not tried building it yet.
> Maybe, but I don't see where?

OK, I think I misread the code.  I guess it's the double negative of
'nomagicopen' being set to FALSE that confused me.

> By the way, I just pushed a test
> involving eof and <<>> as ad77c200c8a4ed.

I don't see eof() in that commit, though the test you added is
a good one.

> eof() (with empty parentheses)
> still continues to open the next file the old way.
> > Would it not be better to flag in GvEGVx(PL_argvgv) to remember which
> > of <>/<<>> was last used?  There is plenty of room in GvFLAGS.
> What would that solve? The point is that <> and <<>> differ on how they
> open the next upcoming file. This is not a property of ARGV.

If I understand correctly, eof() tries opening the next file at an
individual file's EOF.  I thought you might consider having it reuse
the last <> or <<>>, to avoid giving a false sense of security to peo-
ple who do:

while (<<>>) {
    blah_blah_blah() if eof();

where the eof() might to a 2-arg open.

Then again, I haven't tested any of this (I don't have time right
now), so I may be completely wrong.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About