Re: a bugfix for Pod::Html (in diff -u format)
[p5sagit/p5-mst-13.2.git] / pod / buildtoc.PL
index 762434e..acb45d6 100644 (file)
@@ -39,7 +39,11 @@ print OUT <<'!NO!SUBS!';
 #
 # buildtoc
 #
-# Build perltoc.pod and sanity check the list of pods against all
+# !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
+# This file is autogenerated by buildtoc.PL.
+# Edit that file and run it to effect changes.
+#
+# Builds perltoc.pod and sanity checks the list of pods against all
 # of the MANIFEST, perl.pod, and ourselves.
 #
 
@@ -55,18 +59,164 @@ if (-d "pod") {
   die "$0: failed to chdir('pod'): $!\n" unless chdir("pod");
 }
 
-@pods = qw(
-          perl perlfaq perlfaq1 perlfaq2 perlfaq3 perlfaq4 perlfaq5
-          perlfaq6 perlfaq7 perlfaq8 perlfaq9 perldelta perldata
-          perlsyn perlop perlre perlrun perlfunc perlvar perlsub
-          perlmod perlmodlib perlmodinstall perlfork perlform perllocale 
-          perlref perlreftut perldsc
-          perllol perlboot perltoot perltootc perlobj perltie perlbot perlipc
-          perldbmfilter perldebug perlnumber perldebguts
-          perldiag perlsec perltrap perlport perlstyle perlpod perlbook
-          perlembed perlapio perlxs perlxstut perlguts perlcall perlcompile
-          perlapi perlintern perlhist
-         );
+@ARCHPODS = qw(
+    perlaix    
+    perlapollo
+    perlamiga          
+    perlbeos
+    perlbs2000
+    perlce
+    perlcygwin          
+    perldgux             
+    perldos             
+    perlepoc             
+    perlfreebsd             
+    perlhpux            
+    perlhurd            
+    perlirix            
+    perlmachten         
+    perlmacos
+    perlmint
+    perlmpeix
+    perlnetware             
+    perlos2             
+    perlos390           
+    perlqnx
+    perlplan9
+    perlsolaris
+    perltru64
+    perluts
+    perlvmesa
+    perlvms             
+    perlvos             
+    perlwin32           
+          );
+
+@CJKPODS = qw(
+    perlcn
+    perljp
+    perlko
+    perltw
+          );
+
+@pods = 
+  (
+    qw(
+
+    perl
+    perlintro
+    perlfaq
+    perltoc
+    perlbook
+
+    perlsyn
+    perldata
+    perlop
+    perlsub
+    perlfunc
+    perlreftut
+    perldsc
+    perlrequick
+    perlpod
+    perlpodspec
+    perlstyle
+    perltrap
+
+    perlrun
+    perldiag
+    perllexwarn
+    perldebtut
+    perldebug
+
+    perlvar
+    perllol
+    perlopentut
+    perlpacktut
+    perlretut
+
+    perlre
+    perlref
+
+    perlform
+
+    perlboot
+    perltoot
+    perltooc
+    perlobj
+    perlbot
+    perltie
+
+    perlipc
+    perlfork
+    perlnumber
+
+    perlthrtut
+    perlothrtut
+
+    perlport
+    perllocale
+    perluniintro
+    perlunicode
+    perlebcdic
+
+    perlsec
+
+    perlmod
+    perlmodinstall
+    perlmodlib
+    perlmodstyle
+    perlnewmod
+
+    perlfaq1            
+    perlfaq2            
+    perlfaq3            
+    perlfaq4            
+    perlfaq5            
+    perlfaq6            
+    perlfaq7            
+    perlfaq8            
+    perlfaq9            
+
+    perlcompile        
+
+    perlembed          
+    perldebguts         
+    perlxstut           
+    perlxs              
+    perlclib            
+    perlguts            
+    perlcall            
+    perlutil            
+    perlfilter          
+    perldbmfilter       
+    perlapi             
+    perlintern          
+    perliol            
+    perlapio            
+    perltodo            
+    perlhack            
+
+    perlhist           
+    perldelta           
+    perl572delta         
+    perl571delta         
+    perl570delta         
+    perl561delta         
+    perl56delta         
+    perl5005delta       
+    perl5004delta       
+
+    ),
+
+    @ARCHPODS,
+
+  );
+
+for (@ARCHPODS) { s/$/.pod/ }
+@ARCHPODS{@ARCHPODS} = ();
+
+for (@CJKPODS) { s/$/.pod/ }
+@CJKPODS{@CJKPODS} = ();
 
 for (@pods) { s/$/.pod/ }
 @pods{@pods} = ();
@@ -84,7 +234,7 @@ close(MANI);
 open(PERLPOD, "perl.pod") || die "$0: opening perl.pod failed: $!\n";
 while (<PERLPOD>) {
   if (/^For ease of access, /../^\(If you're intending /) {
-       if (/^\s+(perl\w+)\s+Perl /) {
+       if (/^\s+(perl\S*)\s+\w/) {
                push @PERLPODS, "$1.pod";
        }
   }
@@ -94,6 +244,11 @@ die "$0: could not find the pod listing of perl.pod\n"
   unless @PERLPODS;
 @PERLPODS{@PERLPODS} = ();
 
+# Delete the CJK because we cannot mix their encodings.
+delete @PERLPODS{@CJKPODS};
+delete @PODS{@CJKPODS};
+delete @pods{@CJKPODS};
+
 # Cross-check against ourselves
 # Cross-check against the MANIFEST
 # Cross-check against the perl.pod
@@ -102,7 +257,7 @@ foreach my $i (sort keys %PODS) {
   warn "$0: $i exists but is unknown by buildtoc\n"
        unless exists $pods{$i};
   warn "$0: $i exists but is unknown by ../MANIFEST\n"
-       unless exists $MANIPODS{$i};
+       if !exists $MANIPODS{$i} && !exists $ARCHPODS{$i} && !exists $CJKPODS{$i};
   warn "$0: $i exists but is unknown by perl.pod\n"
        unless exists $PERLPODS{$i};
 }
@@ -148,12 +303,14 @@ find \&getpods => qw(../lib ../ext);
 
 sub getpods {
     if (/\.p(od|m)$/) {
-       # Skip .pm files that have corresponding .pod files, and Functions.pm.
-       return if /(.*)\.pm$/ && -f "$1.pod";
        my $file = $File::Find::name;
-       return if $file eq '../lib/Pod/Functions.pm'; # Used only by pod itself
-
-       die "tut $name" if $file =~ /TUT/;
+        return if $file eq '../lib/Pod/Functions.pm'; # Used only by pod itself
+        return if $file =~ m!lib/Attribute/Handlers/demo/!;
+        return if $file =~ m!lib/Net/FTP/.+\.pm!; # Hi, Graham! :-)
+        return if $file =~ m!lib/Math/BigInt/t/!;
+        return if $file =~ m!/Devel/PPPort/[Hh]arness|lib/Devel/Harness!i;
+        return if $file =~ m!XS/(?:APItest|Typemap)!;
+        die "tut $name" if $file =~ /TUT/;
        unless (open (F, "< $_\0")) {
            warn "bogus <$file>: $!";
            system "ls", "-l", $file;
@@ -217,7 +374,7 @@ podset( @modules[ sort { $modname[$a] cmp $modname[$b] } 0 .. $#modules ] );
        Here should be listed all the extra programs' documentation, but they
        don't all have manual pages yet:
 
-       =over
+       =over 4
 
        =item a2p
 
@@ -270,13 +427,13 @@ sub podset {
        }
        if (s/^=head1 (.*)/=item $1/) {
            unhead2();
-           output "=over\n\n" unless $inhead1;
+           output "=over 4\n\n" unless $inhead1;
            $inhead1 = 1;
            output $_; nl(); next;
        }
        if (s/^=head2 (.*)/=item $1/) {
            unitem();
-           output "=over\n\n" unless $inhead2;
+           output "=over 4\n\n" unless $inhead2;
            $inhead2 = 1;
            output $_; nl(); next;
        }
@@ -288,7 +445,7 @@ sub podset {
            s/\s+$//;
            next if /^[\d.]+$/;
            next if $pod eq 'perlmodlib' && /^ftp:/;
-           ##print "=over\n\n" unless $initem;
+           ##print "=over 4\n\n" unless $initem;
            output ", " if $initem;
            $initem = 1;
            s/\.$//;
@@ -363,3 +520,7 @@ sub output ($) {
 
 !NO!SUBS!
 
+close OUT or die "Can't close $file: $!";
+chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
+exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
+chdir $origdir;