perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sergeant <m...@sergeant.org>
Subject [PATCH] Apache::Test can never use mp1 with mp2 installed
Date Fri, 15 Jul 2005 20:25:59 GMT
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 {


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


Mime
View raw message