This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
To-do test for #109746
[perl5.git] / autodoc.pl
index d243592..bff2094 100644 (file)
@@ -13,8 +13,7 @@
 # Has an optional arg, which is the directory to chdir to before reading
 # MANIFEST and *.[ch].
 #
-# This script is normally invoked as part of 'make all', but is also
-# called from regen.pl.
+# This script is invoked as part of 'make all'
 #
 # '=head1' are the only headings looked for.  If the next line after the
 # heading begins with a word character, it is considered to be the first line
@@ -254,7 +253,7 @@ sub output {
     my ($podname, $header, $dochash, $missing, $footer) = @_;
     my $fh = open_new("pod/$podname.pod", undef,
                      {by => "$0 extracting documentation",
-                      from => 'the C source files'});
+                       from => 'the C source files'}, 1);
 
     print $fh $header;
 
@@ -325,21 +324,19 @@ foreach (@{(setup_embed())[0]}) {
                        };
 }
 
-my $file;
 # glob() picks up docs from extra .c or .h files that may be in unclean
 # development trees.
-my $MANIFEST = do {
-  local ($/, *FH);
-  open FH, "MANIFEST" or die "Can't open MANIFEST: $!";
-  <FH>;
-};
+open my $fh, '<', 'MANIFEST'
+    or die "Can't open MANIFEST: $!";
+while (my $line = <$fh>) {
+    next unless my ($file) = $line =~ /^(\S+\.[ch])\t/;
 
-for $file (($MANIFEST =~ /^(\S+\.c)\t/gm), ($MANIFEST =~ /^(\S+\.h)\t/gm)) {
     open F, "< $file" or die "Cannot open $file for docs: $!\n";
     $curheader = "Functions in file $file\n";
     autodoc(\*F,$file);
     close F or die "Error closing $file: $!\n";
 }
+close $fh or die "Error whilst reading MANIFEST: $!";
 
 for (sort keys %funcflags) {
     next unless $funcflags{$_}{flags} =~ /d/;