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

The documentation mentions the following:
no warnings 'File::Find';

Have you tried it? It works for me.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Suppress 'Can't chdir to' warnings for File::Find
by mabossert (Scribe) on Apr 28, 2016 at 17:15 UTC

    Well, humble pie, here I come. I saw that and assumed it was unrelated...tried it and it works perfectly. Thanks!

      In case there are warnings that aren't related to permission issues that show up, instead of disabling warnings, you could stash any warnings File::Find throws into an array, and quickly grep through them for lines not matching any expected warnings to ensure nothing bad is happening in the background without being notified:

      use warnings; use strict; use File::Find; my @warnings; { local $SIG{__WARN__} = sub {push @warnings, shift;}; find ({wanted => \&wanted}, '.'); } warn "this warning outside of File::Find, so will print normally\n"; sub wanted { # do stuff } print "caught: $_\n" for @warnings; __END__ this warning outside of File::Find, so will print normally caught: Can't cd to (./) test: Permission denied at find.pl line 10.