in reply to Re: File::Glob infinate loop with while loop unlike core glob function
in thread File::Glob infinite loop with while loop unlike core glob function
No, I don't think it is a bug. glob returns a list
This is the bug, that it returns a list in scalar context, and the docs don't warn about it.
In list context, returns a (possibly empty) list of filename expansions on the value of EXPR such as the standard Unix shell /bin/csh would do. In scalar context, glob iterates through such filename expansions, returning undef when the list is exhausted.use File::Glob ':glob'; overrides glob (csh_glob) with a function that behave differently in scalar context (bsd_glob), and the documentation dosn't warn you explicitly....
Beginning with v5.6.0, this operator is implemented using the standard "File::Glob" extension. See File::Glob for details, including "bsd_glob" which does not treat whitespace as a pattern separator.
making bsd_glob DWIM in scalar context is trivial (just copy/paste from csh_glob)
fixing the pod is equally trivial.
No, I'm not contemplating filing a bug report, Gulliver should :)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: File::Glob infinate loop with while loop unlike core glob function
by jpl (Monk) on Jul 31, 2011 at 17:43 UTC | |
by Anonymous Monk on Jul 31, 2011 at 21:10 UTC | |
by jpl (Monk) on Aug 01, 2011 at 13:55 UTC | |
by jpl (Monk) on Aug 01, 2011 at 10:45 UTC |
In Section
Seekers of Perl Wisdom