Subject: | Makefile.PL maze can lead to unnecessary FAIL reports |
There have been several FAIL reports on CPAN testers that could have
been avoided. They all happened because the user had neither mod_perl
nor mod_perl2 installed. Instead of simply declaring one of the two as a
prerequisite, the Makefile.PL died, leaving the toolchain programs in
FAIL state.
Unfortunately the Makefile.PL is a bit too clever for me, so I could not
do a full cleanup myself. All I could do is cover the situation in which
the Makefile.PL failed for me. I think this patch is perfectly backwards
compatible, but please review carefully.
Please note that I chose to help the user a bit by providing better
diagnostics. For example, the following erro message is not very helpful:
don't know anything about mod_perl generation: 0
currently supporting only generations 1 and 2
By adding the following you can do your users a great favour:
Please specify MOD_PERL=1 or MOD_PERL=2 on the commandline
Thanks,
Subject: | Apache-Reload-0.10-ANDK-01.patch |
--- Makefile.PL.orig 2008-03-21 10:57:20.000000000 +0100
+++ Makefile.PL 2008-03-21 11:33:40.000000000 +0100
@@ -100,13 +100,14 @@
unless ($wanted == 1 || $wanted == 2) {
die "don't know anything about mod_perl generation: $wanted\n" .
- "currently supporting only generations 1 and 2";
+ "currently supporting only generations 1 and 2.\n" .
+ "Please specify MOD_PERL=1 or MOD_PERL=2 on the commandline\n";
}
my $selected = 0;
if ($wanted == 1) {
- require_mod_perl();
+ require_mod_perl(1);
if ($mod_perl::VERSION >= 1.99) {
# so we don't pick 2.0 version if 1.0 is wanted
die "You don't seem to have mod_perl 1.0 installed";
@@ -115,7 +116,7 @@
}
elsif ($wanted == 2) {
#warn "Looking for mod_perl 2.0";
- require_mod_perl();
+ require_mod_perl(2);
if ($mod_perl::VERSION < 2.0) {
die "You don't seem to have mod_perl 2.0 installed";
}
@@ -131,8 +132,25 @@
}
sub require_mod_perl {
- eval { require mod_perl };
- eval { require mod_perl2 } if ($@);
+ my($rversion) = @_;
+ if (!$rversion || $rversion==1){
+ eval { require mod_perl };
+ if ($rversion == 1){
+ if ($@){
+ warn "Note: Did not find mod_perl installed\n";
+ }
+ return; # do not die, let PREREQ_PM handle it
+ }
+ }
+ if ($@ || !$rversion || $rversion==2){
+ eval { require mod_perl2 };
+ if ($rversion == 2){
+ if ($@){
+ warn "Note: Did not find mod_perl2 installed\n";
+ }
+ return; # do not die, let PREREQ_PM handle it
+ }
+ }
die "Can't find mod_perl installed\nThe error was: $@" if $@;
}