This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Rely on C89 <string.h>
[perl5.git] / Porting / pod_lib.pl
index 06c3294..25cf691 100644 (file)
@@ -1,7 +1,6 @@
 #!/usr/bin/perl -w
 
 use strict;
-use Digest::MD5 'md5';
 use File::Find;
 
 =head1 NAME
@@ -62,6 +61,17 @@ Prints C<ABORTED> to STDERR.
 
 =cut
 
+# In some situations, eg cross-compiling, we get run with miniperl, so we can't use Digest::MD5
+my $has_md5;
+BEGIN {
+    use Carp;
+    $has_md5 = eval { require Digest::MD5; Digest::MD5->import('md5');  1; };
+}
+
+
+# make it clearer when we haven't run to completion, as we can be quite
+# noisy when things are working ok
+
 sub my_die {
     print STDERR "$0: ", @_;
     print STDERR "\n" unless $_[-1] =~ /\n\z/;
@@ -366,6 +376,8 @@ my %state = (
         my $file = shift;
         local $_;
 
+        return if !$has_md5;
+
         # Initialise the list of possible source files on the first call.
         unless (%Lengths) {
             __prime_state() unless $state{master};
@@ -391,7 +403,7 @@ sub __prime_state {
     my $filename = "pod/$source";
     my $contents = slurp_or_die($filename);
     my @want =
-        $contents =~ /perldelta - what is new for perl v(5)\.(\d+)\.(\d+)\n/;
+        $contents =~ /perldelta - what is new for perl v(5)\.(\d+)\.(\d+)\r?\n/;
     die "Can't extract version from $filename" unless @want;
     my $delta_leaf = join '', 'perl', @want, 'delta';
     $state{delta_target} = "$delta_leaf.pod";
@@ -495,8 +507,6 @@ sub __prime_state {
         }
     }
     close $master or my_die("close pod/perl.pod: $!");
-    # This has to be special-cased somewhere. Turns out this is cleanest:
-    push @{$state{master}}, ['a2p', 'x2p/a2p.pod', {toc_omit => 1}];
 
     my_die("perl.pod sets flags for unknown pods: "
            . join ' ', sort keys %flag_set)
@@ -655,9 +665,4 @@ sub get_pod_metadata {
 
 1;
 
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
 # ex: set ts=8 sts=4 sw=4 et: