hi all...

in TestConfigPerl we have this logic and comment

    # modules like Embperl.so need mod_perl.so to be loaded first,
    # so make sure that it's loaded before files inherited from the
    # global httpd.conf
    $self->preamble_first(IfModule => '!mod_perl.c', $cfg);

what this does is load mod_perl.so ahead of all other modules, giving it
least priority.  there are a few problems I see with this

  - in 1.3 this is a _very_ untypical setup - mod_perl.so needs to be loaded
last so that it gets first crack at each phase.

  - in 2.X order doesn't matter due to the new hooking API, but it _does_
matter for overriding directives.  that is, you can't load mod_perl.so first
and get first crack at _directive_ parsing.

anyway, I guess what I'm saying is that 99% of the time we want mod_perl to
have the highest priority, but we do the exact opposite with Apache-Test,
which is probably ungood.

now, in all fairness to embperl I don't want to just yank this out without
giving gerald some alternative.  however, I think it's a bad idea to create
a test environment that doesn't accurately represent the most common case.
so, here are some possible solutions...

  - historically I think this was introduced before we had
extra.last.conf.in functionality.  gerald, does using that file help you?

  - we could provide for an extra argument to configure_libmodperl() which
would place mod_perl.so first instead of the (new) default of last.  this
would allow folks like embperl to do something like

  package My::TestConfigurePerl;
  our @ISA = qw(Apache::TestConfigurePerl);
  sub configure_libmodperl {  shift->SUPER::configure_libmodperl(1) }

and have things work the way they did before.  patch attached.

thoughts?

--Geoff
Index: lib/Apache/TestConfigPerl.pm
===================================================================
--- lib/Apache/TestConfigPerl.pm	(revision 152675)
+++ lib/Apache/TestConfigPerl.pm	(working copy)
@@ -29,6 +29,8 @@
 sub configure_libmodperl {
     my $self = shift;
 
+    my $first = shift;
+
     my $server  = $self->{server};
     my $libname = $server->version_of(\%libmodperl);
     my $vars = $self->{vars};
@@ -94,10 +96,17 @@
         debug $msg;
     }
 
-    # modules like Embperl.so need mod_perl.so to be loaded first,
-    # so make sure that it's loaded before files inherited from the
-    # global httpd.conf
-    $self->preamble_first(IfModule => '!mod_perl.c', $cfg);
+    if ($first) {
+        # modules like Embperl.so need mod_perl.so to be loaded first,
+        # so make sure that it's loaded before files inherited from the
+        # global httpd.conf
+        $self->preamble_first(IfModule => '!mod_perl.c', $cfg);
+    }
+    else {
+        # the default for most mod_perl installations - give mod_perl
+        # highest priority by loading it last.
+        $self->preamble(IfModule => '!mod_perl.c', $cfg);
+    }
 
 }
 

Reply via email to