Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Why $File::Find::prune = 1 returns used only once error

by haukex (Archbishop)
on Apr 17, 2021 at 07:56 UTC ( [id://11131400]=note: print w/replies, xml ) Need Help??


in reply to Why $FIle::Find::prune = 1 returns used only once error

The difference is that use executes the module's code at compile time, basically making $File::Find::prune known earlier than with require, which executes at runtime. One really simple workaround is to use the variable twice: $File::Find::prune = $File::Find::prune = 1; (Update: Of course this removes typo protection if you happen to make the same typo twice, e.g. if you used copy&paste on the variable name.)

Replies are listed 'Best First'.
Re^2: Why $File::Find::prune = 1 returns used only once error
by h2 (Beadle) on Apr 18, 2021 at 21:49 UTC
    This was also a clever little trick, which is likewise good to know as a possible solution. In the end, however, I ended up, basically by accident, using it twice anyway, for an actual reason, so the issue went away, but it's good to be aware of these little intricacies, which actually led me to not use this feature in the past since the warnings were a mystery to me and I just moved on, so now that's all resolved and working fine. It's odd what missing one key bit of information that isn't very intuitive or obvious can do in terms of hindering progress and development.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-18 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found