This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Refactor buildtoc's use of File::Find::find() to converge with installman's.
authorNicholas Clark <nick@ccl4.org>
Thu, 22 Dec 2011 09:41:58 +0000 (10:41 +0100)
committerNicholas Clark <nick@ccl4.org>
Sat, 24 Dec 2011 08:30:09 +0000 (09:30 +0100)
pod/buildtoc

index cf17a9a..61ea096 100644 (file)
@@ -24,22 +24,27 @@ 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!/Pod/Functions.pm\z!; # Used only by pod itself
               return if m!(?:^|/)t/!;
               return if m!lib/Net/FTP/.+\.pm!; # Hi, Graham! :-)
-              return if m!XS/(?:APItest|Typemap)!;
-              return if s!pm\z!pod! && -e $_;
+              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');
@@ -91,7 +96,6 @@ foreach my $type (qw(PRAGMA MODULE)) {
 EOPOD2B
 
     foreach my $name (sort keys %{$Found{$type}}) {
-        next if is_duplicate_pod($Found{$type}{$name});
         $roffitall .= "    \$libdir/$name.3 \\\n";
         podset($name, $Found{$type}{$name});
     }