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.
Created
test.plin my home directory:Then:
$ chmod 755 test.pl $ mkdir /tmp/findtest $ cd /tmp/findtest $ ln -s /tmp/doesnotexist linkylink $ ~/test.pl .Results in: