Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Suppress 'Can't chdir to' warnings for File::Find

by jellisii2 (Hermit)
on Apr 29, 2016 at 12:05 UTC ( [id://1161871]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Suppress 'Can't chdir to' warnings for File::Find
in thread Suppress 'Can't chdir to' warnings for File::Find

My gut on the performance hit is stats the item in question twice. I could be COMPLETELY wrong on that though.

Replies are listed 'Best First'.
Re^4: Suppress 'Can't chdir to' warnings for File::Find
by stevieb (Canon) on Apr 29, 2016 at 13:12 UTC

    There's a feature with stat() where it caches the item being tested on first call, to reduce overhead that would likely help reduce checking time. Note the _ at the end of the one-liner below. That's the cached item.

    perl -wMstrict -E 'say -f "utf.pl" && say -e _'

    Also, one could also look at the no_chdir => 1 feature of File::Find, however I don't know if one would get different warnings in that case, or if it'd just fail silently and move along when it encountered a restricted dir.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-25 02:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found