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.
In reply to Re^3: Suppress 'Can't chdir to' warnings for File::Find
by stevieb
in thread Suppress 'Can't chdir to' warnings for File::Find
by mabossert
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |