Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^5: File::Glob infinate loop with while loop unlike core glob function

by jpl (Monk)
on Aug 01, 2011 at 13:55 UTC ( #917854=note: print w/ replies, xml ) Need Help??


in reply to Re^4: File::Glob infinate loop with while loop unlike core glob function
in thread File::Glob infinite loop with while loop unlike core glob function

The more I look at this, the more I'm coming around to your point of view. When I look at

ext/File-Glob/t/global.t

they appear to be doing extensive testing to make sure a glob overload behaves in the same way as the core glob, including loops using <> and explicit invocations of glob. If I modify global.t as follows

4,5c4 < chdir 't' if -d 't'; < @INC = '../lib'; --- > chdir '/home/jpl/src/perl-5.14.1/t'; 94a94,111 > > @s = (); > while (glob("/tmp/dir with spaces/*")) { > push @s, $_; > last if (@s > 1000); > } > print(scalar(@s), "\n"); > print(join(" ", @s), "\n"); > > package Bar; > use File::Glob ':glob'; > @s = (); > while (glob("/tmp/dir with spaces/*")) { > push @s, $_; > last if (@s > 1000); > } > print(scalar(@s), "\n"); > # print(join(" ", @s), "\n");
I get
2 /tmp/dir with 1001
at the end of the output (the directory has 3 entries). It's above my pay grade to figure out why this happens, or how to make the replacement using :glob behave as core glob does, but I'm running out of arguments why the current behavior is correct. Your suggestion of a new tag to get this behavior seems reasonable.


Comment on Re^5: File::Glob infinate loop with while loop unlike core glob function
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://917854]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-12-27 23:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls