The logic within the File::Find::find() callback was to attempt to open any
file, and if it failed, politely report a warning and run system ls -l on the
offending name. It's been the same since pod/buildtoc was added in December
1995 by commit
cb1a09d0194fed9b ("This is patch.2b1g to perl5.002beta1.").
However the ls -l would never have worked, as it uses the full pathname
(from the top of the build tree), while File::Find::find() has changed the
current directory to the directory which it is scanning. The failure to open
"should" never happen, so if it does, it should be brought to a human's
attention instead of being glossed over.
The new approach takes less code.
return if $file =~ m!XS/(?:APItest|Typemap)!;
my $pod = $file;
return if $pod =~ s/pm$/pod/ && -e $pod;
- unless (open my $f, '<', $_) {
- warn "$0: bogus <$file>: $!";
- system "ls", "-l", $file;
- }
- else {
+ open my $f, '<', $_ or my_die "Can't open file '$_': $!";
+ {
my $line;
while ($line = <$f>) {
if ($line =~ /^=head1\s+NAME\b/) {