This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Epigraph for 5.21.3
[perl5.git] / Porting / pod_lib.pl
index 06c3294..3088d16 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};
@@ -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)