You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Matt Sergeant <ma...@sergeant.org> on 2005/07/15 22:25:59 UTC

[PATCH] Apache::Test can never use mp1 with mp2 installed

There's a bug in Apache::Test that prevents it from working properly 
when you're trying to test something with mp1 when you've got mp2 
installed.

What happens is that Apache::TestConfig does this:

use constant IS_MOD_PERL_2       =>
     eval { require mod_perl2 } || 0;

Which of course is wrong, that should be IS_MOD_PERL_2_INSTALLED for a 
start, but I haven't patched that.

What then happens later is in TestRunPerl we do:

     if ($rev == 2) {
         eval { require mod_perl2 };
     } else {
         eval { require mod_perl };
     }
     my $mp_ver = $mod_perl::VERSION;

Which now because mod_perl2 is already loaded, always returns the mp2 
version.

Side comment: This stuff is a real maze of twisty passages - the only 
way I could find to debug this was to add Carp::cluck() to mod_perl2.pm 
so I knew what was loading it. I wish it were written a bit simpler. 
Maybe I'm underestimating the complexity of what it's trying to do.

Patch (mail.app will strip trailing whitespace, so apply with -b or 
just do it manually):

--- lib/Apache/TestRunPerl.pm.orig      Fri Jul 15 16:17:05 2005
+++ lib/Apache/TestRunPerl.pm   Fri Jul 15 16:17:50 2005
@@ -49,6 +49,7 @@
      my $ver = $test_config->server->{version};

      # sanity checking and loading the right mod_perl version
+    delete $INC{'mod_perl.pm'};
      if ($rev == 2) {
          eval { require mod_perl2 };
      } else {


Re: [PATCH] Apache::Test can never use mp1 with mp2 installed

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Matt Sergeant wrote:
> There's a bug in Apache::Test that prevents it from working properly
> when you're trying to test something with mp1 when you've got mp2
> installed.
> 
> What happens is that Apache::TestConfig does this:
> 
> use constant IS_MOD_PERL_2       =>
>     eval { require mod_perl2 } || 0;
> 
> Which of course is wrong, that should be IS_MOD_PERL_2_INSTALLED for a
> start, but I haven't patched that.

:)

> 
> What then happens later is in TestRunPerl we do:
> 
>     if ($rev == 2) {
>         eval { require mod_perl2 };
>     } else {
>         eval { require mod_perl };
>     }
>     my $mp_ver = $mod_perl::VERSION;
> 
> Which now because mod_perl2 is already loaded, always returns the mp2
> version.

yah, ok.

> 
> Side comment: This stuff is a real maze of twisty passages - the only
> way I could find to debug this was to add Carp::cluck() to mod_perl2.pm
> so I knew what was loading it. I wish it were written a bit simpler.
> Maybe I'm underestimating the complexity of what it's trying to do.

Apache-Test is the best piece of software I've used lately.  it's also the
worst piece of software I've had to maintain lately :)

it really needs to be true OO and not, as you say, a maze of twisty
passages, with various "classes" magically adding foo to other "classes."
someday I'll re-attempt a complete OO rewrite from scratch when I have a
month of nothing to do :)


>      # sanity checking and loading the right mod_perl version
> +    delete $INC{'mod_perl.pm'};
>      if ($rev == 2) {
>          eval { require mod_perl2 };
>      } else {

applied, with comments.

thanks!

--Geoff

Re: [PATCH] Apache::Test can never use mp1 with mp2 installed

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Matt Sergeant wrote:
> There's a bug in Apache::Test that prevents it from working properly
> when you're trying to test something with mp1 when you've got mp2
> installed.
> 
> What happens is that Apache::TestConfig does this:
> 
> use constant IS_MOD_PERL_2       =>
>     eval { require mod_perl2 } || 0;
> 
> Which of course is wrong, that should be IS_MOD_PERL_2_INSTALLED for a
> start, but I haven't patched that.

:)

> 
> What then happens later is in TestRunPerl we do:
> 
>     if ($rev == 2) {
>         eval { require mod_perl2 };
>     } else {
>         eval { require mod_perl };
>     }
>     my $mp_ver = $mod_perl::VERSION;
> 
> Which now because mod_perl2 is already loaded, always returns the mp2
> version.

yah, ok.

> 
> Side comment: This stuff is a real maze of twisty passages - the only
> way I could find to debug this was to add Carp::cluck() to mod_perl2.pm
> so I knew what was loading it. I wish it were written a bit simpler.
> Maybe I'm underestimating the complexity of what it's trying to do.

Apache-Test is the best piece of software I've used lately.  it's also the
worst piece of software I've had to maintain lately :)

it really needs to be true OO and not, as you say, a maze of twisty
passages, with various "classes" magically adding foo to other "classes."
someday I'll re-attempt a complete OO rewrite from scratch when I have a
month of nothing to do :)


>      # sanity checking and loading the right mod_perl version
> +    delete $INC{'mod_perl.pm'};
>      if ($rev == 2) {
>          eval { require mod_perl2 };
>      } else {

applied, with comments.

thanks!

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org