Subject: | MakeMaker explodes and fails to install if Pod::Man is unavailable |
Date: | Mon, 23 Feb 2009 14:29:58 -0500 |
To: | bug-extutils-makemaker [...] rt.cpan.org |
From: | Jesse Vincent <jesse [...] bestpractical.com> |
Sometimes in the life of a Perl installation, a module might go missing
or be unavailable. Sometimes this might be because an installation of a
dual-lifed module goes awry. One module this might happen to is
Pod::Man. It's been core forever, but is now dual-lifed. And now
depends on Pod::Simple.
If something bad were to happen to Pod::Man or Pod::Simple, MakeMaker
would fail.
That might look like this:
17h:shipwright-trunk jesse$ make
cp bin/shipwright blib/script/shipwright
/opt/perl-5.8.9/bin/perl "-Iinc" "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/shipwright
Can't locate Pod/Simple.pm in @INC (@INC contains: inc /Users/jesse/git/bps/prophet.git/lib /Users/jesse/git/bps/sd.git/lib /opt/perl-5.8.9/lib/5.8.9/darwin-2level /opt/perl-5.8.9/lib/5.8.9 /opt/perl-5.8.9/lib/site_perl/5.8.9/darwin-2level /opt/perl-5.8.9/lib/site_perl/5.8.9 .) at /opt/perl-5.8.9/lib/5.8.9/Pod/Man.pm line 34.
BEGIN failed--compilation aborted at /opt/perl-5.8.9/lib/5.8.9/Pod/Man.pm line 34.
Compilation failed in require at /opt/perl-5.8.9/lib/5.8.9/ExtUtils/Command/MM.pm line 95.
make: *** [manifypods] Error 2
All well and good when it's a thirdp-party distribution. But you'd
see the same error if you tried to install Pod::Simple, Pod::Man
or even ExtUtils::MakeMaker itself.
At this point, you have a bunch of broken eggs and no chicken around to
make more. The attached patch provides MakeMaker with the ability to make
more eggs without a chicken.
diff --git a/trunk/lib/ExtUtils/Command/MM.pm b/trunk/lib/ExtUtils/Command/MM.pm
index 4f7b73a..1685b8e 100644
--- a/trunk/lib/ExtUtils/Command/MM.pm
+++ b/trunk/lib/ExtUtils/Command/MM.pm
@@ -87,12 +87,22 @@ And the removal of:
If no arguments are given to pod2man it will read from @ARGV.
+If Pod::Man is unavailable, this function will warn and return undef.
+
=cut
sub pod2man {
local @ARGV = @_ ? @_ : @ARGV;
- require Pod::Man;
+ {
+ local $@;
+ eval { require Pod::Man };
+ if (my $err = $@) {
+ warn "Pod::Man is not available: $err\n".
+ "man pages will not be generated during this install.\n";
+ return undef;
+ }
+ }
require Getopt::Long;
# We will cheat and just use Getopt::Long. We fool it by putting
--