diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-12-22 11:26:29 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-12-24 09:30:09 +0100 |
commit | 9bbb230a203c96fa7e8a45ef46e37c00319fafb1 (patch) | |
tree | d6bb6acdc88be55d591dbd6e678d4caf805bcfb6 /pod/buildtoc | |
parent | 3bf293368e665fedf90271ec12ba69772cca9a5c (diff) | |
download | perl-9bbb230a203c96fa7e8a45ef46e37c00319fafb1.tar.gz |
Move the common Pod scanning code from installman and buildtoc to pod_lib.pl
The unified code to scan lib/ for Pod is now in pods_to_install().
It returns found Pods partitioned into 'MODULE' and 'PRAGMA', as buildtoc
needs this distinction. installman installs Pods in the same order as before,
as 'PRAGMA' sort lexically after 'MODULE'.
Diffstat (limited to 'pod/buildtoc')
-rw-r--r-- | pod/buildtoc | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/pod/buildtoc b/pod/buildtoc index 61ea096a47..06307c4bc0 100644 --- a/pod/buildtoc +++ b/pod/buildtoc @@ -1,9 +1,8 @@ #!/usr/bin/perl -w use strict; -use vars qw(%Found $Quiet); +use vars qw($Quiet); use File::Spec; -use File::Find; use FindBin; use Text::Wrap; use Getopt::Long; @@ -23,33 +22,9 @@ die "$0: Usage: $0 [--quiet]\n" my $state = get_pod_metadata(0, sub { warn @_ if @_ }, 'pod/perltoc.pod'); -# Find all the modules -# manpages not to be installed -my %do_not_install = map { ($_ => 1) } - qw(Pod::Functions XS::APItest XS::Typemap); - -my %done; -find({no_chdir => 1, - wanted => sub { - if (/\.p(od|m)$/) { - return if m!(?:^|/)t/!; - return if m!lib/Net/FTP/.+\.pm!; # Hi, Graham! :-) - 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; - - return if $do_not_install{$_}; - return if is_duplicate_pod($File::Find::name); - - $Found{/\A[a-z]/ ? 'PRAGMA' : 'MODULE'}{$_} = $File::Find::name; - } - }}, 'lib'); - -my_die "Can't find any pods!\n" unless %done; +my $found = pods_to_install(); + +my_die "Can't find any pods!\n" unless %$found; # 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 @@ -95,9 +70,9 @@ foreach my $type (qw(PRAGMA MODULE)) { EOPOD2B - foreach my $name (sort keys %{$Found{$type}}) { + foreach my $name (sort keys %{$found->{$type}}) { $roffitall .= " \$libdir/$name.3 \\\n"; - podset($name, $Found{$type}{$name}); + podset($name, $found->{$type}{$name}); } } |