I'm using Perl's File::Find module to scan for files, directories, and links. Among other things, I want the utility I'm writing to report broken (dangling in File::Find's parlance) symbolic links. In theory, this is supported by creating a subroutine to be called whenever a broken link has been found, and calling the find
method with a hash reference of appropriate values, such as:
my %options = (
wanted => \&ProcessFile,
follow => 1,
follow_skip => 2,
dangling_symlinks => \&Dangling
);
find(\%options, @ARGV);
Despite deliberately creating a broken link to test this, File::Find never, ever calls the subroutine Dangling
. Everything else works except this feature, i.e. the ProcessFile
sub gets called as expected, links are followed, etc.
Best Answer
Created
test.pl
in my home directory:Then:
Results in: