Author: phred Date: Sun Apr 26 07:02:16 2009 New Revision: 768668 URL: http://svn.apache.org/viewvc?rev=768668&view=rev Log: Fix a bad error in params check for new (mod_perl2 param was unchecked). Warn instead of dying on check for mp/mp2 versions. This was spotted while testing this version on a dual bootstrap system with only mp1 installed.
Modified: perl/Apache-Bootstrap/trunk/Changes perl/Apache-Bootstrap/trunk/README perl/Apache-Bootstrap/trunk/lib/Apache/Bootstrap.pm perl/Apache-Bootstrap/trunk/t/00-load.t Modified: perl/Apache-Bootstrap/trunk/Changes URL: http://svn.apache.org/viewvc/perl/Apache-Bootstrap/trunk/Changes?rev=768668&r1=768667&r2=768668&view=diff ============================================================================== --- perl/Apache-Bootstrap/trunk/Changes (original) +++ perl/Apache-Bootstrap/trunk/Changes Sun Apr 26 07:02:16 2009 @@ -1,8 +1,9 @@ Revision history for Apache-Bootstrap 0.07-dev - - Prerequisites are now or instead of and, since we need to support - mp1 only installations + - fix syntax error in params validation in new (mp2 param unchecked) + - warn instead of dying in new if a module is not present, and then + decide if any modules are present to create a new bootstrap object 0.06 Sat Apr 25 14:07:04 PST 2009 - replace confusing instances of mod_perl1 and mp1 with simply mod_perl Modified: perl/Apache-Bootstrap/trunk/README URL: http://svn.apache.org/viewvc/perl/Apache-Bootstrap/trunk/README?rev=768668&r1=768667&r2=768668&view=diff ============================================================================== --- perl/Apache-Bootstrap/trunk/README (original) +++ perl/Apache-Bootstrap/trunk/README Sun Apr 26 07:02:16 2009 @@ -5,7 +5,7 @@ SYNOPSIS In your Makefile.PL - use Apache::Bootstrap 0.05; + use Apache::Bootstrap 0.06; my $bootstrap; @@ -57,6 +57,9 @@ mod_perl => 0, # any verison of mp1 }); + These code checks to see if either mp1 or mp2 versions are present. One + successful version check means that it returns a valid object. + mp_prereqs() returns the prerequisites for mod_perl versions in a hash reference Modified: perl/Apache-Bootstrap/trunk/lib/Apache/Bootstrap.pm URL: http://svn.apache.org/viewvc/perl/Apache-Bootstrap/trunk/lib/Apache/Bootstrap.pm?rev=768668&r1=768667&r2=768668&view=diff ============================================================================== --- perl/Apache-Bootstrap/trunk/lib/Apache/Bootstrap.pm (original) +++ perl/Apache-Bootstrap/trunk/lib/Apache/Bootstrap.pm Sun Apr 26 07:02:16 2009 @@ -71,6 +71,9 @@ mod_perl => 0, # any verison of mp1 }); +These code checks to see if either mp1 or mp2 versions are present. +One successful version check means that it returns a valid object. + =cut sub new { @@ -79,7 +82,7 @@ die 'perldoc Apache::Bootstrap' unless $args && ref $args eq 'HASH' - && ( defined $args->{mod_perl} or defined $args->{mod_perl} ); + && ( defined $args->{mod_perl} or defined $args->{mod_perl2} ); my %self; if ( defined $args->{mod_perl} ) { @@ -90,16 +93,15 @@ # look for mp1 eval { require mod_perl }; if ($@) { - - die 'mod_perl not present, cannot bootstrap mp1: ' . $@ if $@; + warn("mod_perl not present, cannot bootstrap mp1"); } elsif (( $mod_perl::VERSION < $args->{mod_perl} ) or ( $mod_perl::VERSION >= MIN_MP2_VER ) ) { - die sprintf( "mod_perl version %s not found, we have %s", - $args->{mod_perl}, $mod_perl::VERSION ); + warn(sprintf( 'mod_perl version %s not found, we have %s', + $args->{mod_perl}, $mod_perl::VERSION )); } else { @@ -108,19 +110,21 @@ $self{mod_perl} = $mod_perl::VERSION; } - } elsif ( defined $args->{mod_perl2} ) { + } + + if ( defined $args->{mod_perl2} ) { # look for mp2 eval { require mod_perl2 }; if ($@) { - die 'mod_perl2 not present, cannot bootstrap mp2: ' . $@ if $@; + warn("mod_perl2 not present, cannot bootstrap mp2"); } elsif ( $mod_perl2::VERSION < $args->{mod_perl2} ) { - die sprintf( "mod_perl2 version %s not found, we have %s", - $args->{mod_perl2}, $mod_perl2::VERSION ); + warn(sprintf( "mod_perl2 version %s not found, we have %s", + $args->{mod_perl2}, $mod_perl2::VERSION )); } else { @@ -240,7 +244,7 @@ eval { require mod_perl }; if ($@) { - warn("could not satisfy mp1: $@"); + warn("require mod_perl failed"); return; } @@ -250,7 +254,7 @@ eval { require mod_perl2 }; if ($@) { - warn("could not satisfy mp2: $@"); + warn("require mod_perl2 failed"); return; } @@ -261,11 +265,11 @@ # try mp2 first eval { require mod_perl2 }; if ($@) { - warn("could not satisfy mp2, trying mp1: $@"); + warn("require mod_perl2 failed"); eval { require mod_perl }; if ($@) { - warn("could not satisfy mp1, giving up: $@"); + warn("require mod_perl failed"); return; } } Modified: perl/Apache-Bootstrap/trunk/t/00-load.t URL: http://svn.apache.org/viewvc/perl/Apache-Bootstrap/trunk/t/00-load.t?rev=768668&r1=768667&r2=768668&view=diff ============================================================================== --- perl/Apache-Bootstrap/trunk/t/00-load.t (original) +++ perl/Apache-Bootstrap/trunk/t/00-load.t Sun Apr 26 07:02:16 2009 @@ -18,6 +18,7 @@ ); # try bootstrapping just mp1 + diag("bootstrapping mp1 only"); $mp1_bootstrap = eval { $pkg->new( { mod_perl => 0 } ) }; $skip_mp1 = $@ if $@; @@ -28,9 +29,10 @@ } # try bootstrapping just mp2 + diag("bootstrapping mp2 only"); $mp2_bootstrap = eval { $pkg->new( { mod_perl2 => 1.99022 } ) }; $skip_mp2 = $@ if $@; - + SKIP: { skip $skip_mp2, 1 if $skip_mp2;