diff options
-rw-r--r-- | pod/buildtoc | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/pod/buildtoc b/pod/buildtoc index 5fcb938985..a8a05ff414 100644 --- a/pod/buildtoc +++ b/pod/buildtoc @@ -24,7 +24,7 @@ die "$0: Usage: $0 [--quiet]\n" my $state = get_pod_metadata(0, sub { warn @_ if @_ }, 'pod/perltoc.pod'); # Find all the modules -my @modpods; +my %done; find({no_chdir => 1, wanted => sub { if (/\.p(od|m)$/) { @@ -32,26 +32,19 @@ find({no_chdir => 1, return if m!(?:^|/)t/!; return if m!lib/Net/FTP/.+\.pm!; # Hi, Graham! :-) return if m!XS/(?:APItest|Typemap)!; - my $pod = $_; - return if $pod =~ s/pm$/pod/ && -e $pod; - push @modpods, $_; + return if s!pm\z!pod! && -e $_; + s!\.pod\z!!; + s!\Alib/!!; + s!/!::!g; + my_die("Duplicate files for $_, '$done{$_}' and '$File::Find::name'") + if exists $done{$_}; + + $done{$_} = $File::Find::name; + $Found{/\A[a-z]/ ? 'PRAGMA' : 'MODULE'}{$_} = $File::Find::name; } }}, 'lib'); -my_die "Can't find any pods!\n" unless @modpods; - -my %done; -for (@modpods) { - my $name = $_; - $name =~ s/\.p(m|od)$//; - $name =~ s-\Alib/--; - $name =~ s-/-::-g; - my_die("Duplicate files for $name, '$done{$name}' and '$_'") - if exists $done{$name}; - $done{$name} = $_; - - $Found{$name =~ /^[a-z]/ ? 'PRAGMA' : 'MODULE'}{$name} = $_; -} +my_die "Can't find any pods!\n" unless %done; # Accumulating everything into a lexical before writing to disk dates from the # time when this script also provided the functionality of regen/pod_rules.pl |