Upgrade to Cwd 2.14.
[p5sagit/p5-mst-13.2.git] / pod / buildtoc
index de8e663..a847f88 100644 (file)
@@ -84,13 +84,13 @@ foreach (<MASTER>) {
   next if /^\#/;
 
   # At least one upper case letter somewhere in the first group
-  if (/^(\S+)\s(.*)/ && $1 =~ tr/A-Z//) {
+  if (/^(\S+)\s(.*)/ && $1 =~ tr/h//) {
     # it's a heading
     my $flags = $1;
+    $flags =~ tr/h//d;
     my %flags = (header => 1);
-    $flags{toc_omit} = 1 if $flags =~ tr/O//d;
-    $flags{include} = 1 if $flags =~ tr/I//d;
-    $flags{aux} = 1 if $flags =~ tr/A//d;
+    $flags{toc_omit} = 1 if $flags =~ tr/o//d;
+    $flags{aux} = 1 if $flags =~ tr/a//d;
     die "$0: Unknown flag found in heading line: $_" if length $flags;
     push @Master, [\%flags, $2];
 
@@ -203,6 +203,8 @@ close MASTER;
       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)!;
+      my $pod = $file;
+      return if $pod =~ s/pm$/pod/ && -e $pod;
       die "$0: tut $File::Find::name" if $file =~ /TUT/;
       unless (open (F, "< $_\0")) {
        warn "$0: bogus <$file>: $!";
@@ -257,10 +259,14 @@ sub output ($);
 sub output_perltoc {
   open(OUT, ">perltoc.pod") || die "$0: creating perltoc.pod failed: $!";
 
-  $/ = '';
+  local $/ = '';
 
   ($_= <<"EOPOD2B") =~ s/^\t//gm && output($_);
 
+       # !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
+       # This file is autogenerated by buildtoc from all the other pods.
+       # Edit those files and run buildtoc --build-toc to effect changes.
+
        =head1 NAME
 
        perltoc - perl documentation table of contents
@@ -339,6 +345,7 @@ sub podset {
     my $pod;
 
     while(<>) {
+       tr/\015//d;
        if (s/^=head1 (NAME)\s*/=head2 /) {
            $pod = path2modname($ARGV);
            unhead1();
@@ -506,8 +513,8 @@ sub generate_descrip_mms_1 {
 }
 
 sub generate_descrip_mms_2 {
-  map {sprintf <<'SNIP', $_, $_}
-[.lib.pod]%s.pod : [.pod]%s.pod
+  map {sprintf <<'SNIP', $_, $_ eq 'perlvms' ? 'vms' : 'pod', $_}
+[.lib.pod]%s.pod : [.%s]%s.pod
        @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
        Copy/NoConfirm/Log $(MMS$SOURCE) [.lib.pod]
 SNIP
@@ -590,7 +597,7 @@ sub do_perlpod {
 sub do_podmak {
   my $name = shift;
   my $body = join '', @_;
-  foreach my $variable qw(pod man html tex) {
+  foreach my $variable (qw(pod man html tex)) {
     die "$0: could not find $variable in $name"
       unless $body =~ s{\n\U$variable\E = (?:[^\n]*\\\n)*[^\n]*}
        {"\n" . generate_pod_mak ($variable)}se;
@@ -635,7 +642,9 @@ while (my ($target, $name) = each %Targets) {
   next unless $Build{$target};
   $built++;
   if ($target eq "toc") {
+    print "Now processing $name\n" if $Verbose;
     &output_perltoc;
+    print "Finished\n" if $Verbose;
     next;
   }
   print "Now processing $name\n" if $Verbose;