Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Using grep and glob to find directories containing file

by Anonymous Monk
on Feb 04, 2013 at 16:42 UTC ( #1016976=note: print w/ replies, xml ) Need Help??


in reply to Re: Using grep and glob to find directories containing file
in thread Using grep and glob to find directories containing file

Thanks 7stud for all your patience and persistence in helping me figure out this strange/unexpected behavior.

It seems to me that this is a hidden and potentially significant time-bomb type issue since glob is a core function and it's not inconceivable that people will bury it somewhere in a module where it is used in static context. Then it will lay there waiting until one day someone calls the module from a loop and gets wrong results.

This would be bad enough if the behavior were fully or even adequately documented. But currently, the documentation at best alludes rather obscurely to the behavior that can lead to an issue in such a context.

Do people agree this is a valid issue that needs addressing either in 'fixing' glob or at least in documenting and warning about the behavior?

If so how does one properly report such an issue?


Comment on Re^2: Using grep and glob to find directories containing file
Re^3: Using grep and glob to find directories containing file
by Corion (Pope) on Feb 04, 2013 at 16:49 UTC

    I think the problem is most similar to the problem of keys (not) resetting the iterator over a hash. I guess that the best solution is to not call glob in scalar context at all.

    Most likely, part of the documentation of keys can be adapted to be added to the glob documentation. I would open a bug report using the perlbug utility, best together with a proposed documentation patch that cautions against using glob in scalar context.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2014-10-24 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (134 votes), past polls