hi all...

I just discovered that if you use TestRunPerl to configure a third-party module, and the installer points -apxs to an apache without mod_perl, the test suite blows up due to mod_perl specific configuration directives in httpd.conf.

the end result is that, within the tests, have_module('foo.c') works for every module _except_ mod_perl, since if mod_perl isn't installed the test suit never gets started.

anyway, I think it's a good practice to <IfModule> non-core directives, and it looks like that is being done most of the time (Alias seems to be the exception). the attached patch does that for mod_perl stuff.

--Geoff
Index: lib/Apache/TestConfig.pm
===================================================================
RCS file: 
/home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.175
diff -u -r1.175 TestConfig.pm
--- lib/Apache/TestConfig.pm    1 Oct 2003 13:45:23 -0000       1.175
+++ lib/Apache/TestConfig.pm    2 Oct 2003 19:34:59 -0000
@@ -1259,7 +1259,7 @@
                 $entry = qq(Include "$file");
             }
             elsif ($file =~ /\.pl$/) {
-                $entry = qq(PerlRequire "$file");
+                $entry = qq(<IfModule mod_perl.c>\n\tPerlRequire 
"$file"\n</IfModule>\n);
             }
             else {
                 next;
Index: lib/Apache/TestConfigPerl.pm
===================================================================
RCS file: 
/home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.76
diff -u -r1.76 TestConfigPerl.pm
--- lib/Apache/TestConfigPerl.pm        12 Aug 2003 23:36:51 -0000      1.76
+++ lib/Apache/TestConfigPerl.pm        2 Oct 2003 19:34:59 -0000
@@ -125,7 +125,8 @@
 # propogate trace overrides to the server
 sub configure_trace {
     my $self = shift;
-    $self->postamble(PerlPassEnv => 'APACHE_TEST_TRACE_LEVEL');
+    $self->postamble(IfModule => 'mod_perl.c',
+                     "PerlPassEnv APACHE_TEST_TRACE_LEVEL\n");
 }
 
 sub startup_pl_code {
@@ -163,7 +164,8 @@
     }
 
     if ($self->server->{rev} >= 2) {
-        $self->postamble(PerlSwitches => "-Mlib=$self->{vars}->{serverroot}");
+        $self->postamble(IfModule => 'mod_perl.c',
+                         "PerlSwitches -Mlib=$self->{vars}->{serverroot}\n");
     }
 
     my $startup_pl = catfile $self->{vars}->{t_conf}, 'modperl_startup.pl';
@@ -174,7 +176,8 @@
         close $fh;
     }
 
-    $self->postamble(PerlRequire => $startup_pl);
+    $self->postamble(IfModule => 'mod_perl.c',
+                     "PerlRequire $startup_pl\n");
 }
 
 my %sethandler_modperl = (1 => 'perl-script', 2 => 'modperl');

Reply via email to