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

Thanks for the alternative suggestion. I used the no warnings approach, but thought I would try yours as well. My logic was that maybe it would speed up processing, but surprisingly, it just about doubled the time from 6 secs to 11secs.

That was totally unexpected! If I weren't knee deep in deadlines, I would explore why that is...speed is definitely of the essence for this function.

  • Comment on Re^2: Suppress 'Can't chdir to' warnings for File::Find

Replies are listed 'Best First'.
Re^3: Suppress 'Can't chdir to' warnings for File::Find
by jellisii2 (Hermit) on Apr 29, 2016 at 12:05 UTC
    My gut on the performance hit is stats the item in question twice. I could be COMPLETELY wrong on that though.

      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.