diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-12-17 21:32:58 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-12-19 13:55:18 +0100 |
commit | fcdc6846043a49b06ba005ecfc5e9064e17f049d (patch) | |
tree | eded876ecac8b5a7403e42ae6f93d0304582d8b0 /pod/buildtoc | |
parent | b1a2f073f0230f01166eb98b343be7a3f8c41f0a (diff) | |
download | perl-fcdc6846043a49b06ba005ecfc5e9064e17f049d.tar.gz |
If buildtoc can't open a Pod file, that's fatal, not a warning and skip.
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.
Diffstat (limited to 'pod/buildtoc')
-rw-r--r-- | pod/buildtoc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/pod/buildtoc b/pod/buildtoc index fa7d134506..b8a54825e6 100644 --- a/pod/buildtoc +++ b/pod/buildtoc @@ -37,11 +37,8 @@ find(sub { 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/) { |