Is there a way to catch this error, so the program can continue?
File::Find can preprocess a folder and it can be told to skip chdir. I couldn't reproduce your error so here's an example of using both directives (with your code as a template).
#!/perl/bin/perl use strict; use warnings; use File::Find; my $longdir = 250; find( { wanted => \&wanted, preprocess => \&prep, no_chdir => 1 }, ('j:', 'k:', 'l:', 'm:')); sub wanted { if ($File::Find::name =~ m/lnk$/i) { warn("Cannot process $File::Find::name: Shortcut\n"); } elsif (-f $File::Find::name) { print($File::Find::name, "\n"); } else { warn("Cannot process $File::Find::name: Directory or unknown t +ype\n"); } } sub prep { return length $File::Find::dir > $longdir ? () : @_; }
In reply to Re: Is there a way to catch an error within a module?
by igelkott
in thread Is there a way to catch an error within a module?
by romandas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |