I've brought it up before, but it looks like users are having real problems
with the way 2.0 hooks modules into the request phases.

in 1.0, module order was determined by compile-time ordering or
LoadModule/ClearModuleList/AddModule, neither of which exist in 2.0, where
Apache chose the HOOK_FIRST/HOOK_MIDDLE/HOOK_LAST approach.

the issue is that for mod_perl to be effective, it really needs to get first
crack at the phases.  for instance, currently a PerlTransHandler wouldn't be
guaranteed to run at all if another module (say, mod_proxy) got there first.
 while there are some occasions where you might want mod_proxy there first,
they are typically rare in mod_perl applications.

so, I'd like to suggest that at least for the request-time hooks we move
mod_perl to APR_HOOK_REALLY_FIRST.  this will give users similar behavior to
the way mod_perl used to work in 1.0.

that's what I propose to do immediately.  as a second step, I'm going to
look into making it either compile-time or runtime configurable.  while I'm
sure I can do the former, I'm convinced the latter is possible but probably
not practical.

so, any feedback on stage one (the attached patch).

--Geoff
Index: lib/ModPerl/Code.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/lib/ModPerl/Code.pm,v
retrieving revision 1.116
diff -u -r1.116 Code.pm
--- lib/ModPerl/Code.pm 12 Feb 2004 23:06:23 -0000      1.116
+++ lib/ModPerl/Code.pm 20 Feb 2004 00:49:08 -0000
@@ -33,6 +33,9 @@
 my %not_ap_hook = map { $_, 1 } qw(child_exit response cleanup
                                    output_filter input_filter);
 
+my %not_request_hook = map { $_, 1 } qw(child_init process_connection
+                                        pre_connection open_logs post_config);
+
 my %hook_proto = (
     Process    => {
         ret  => 'void',
@@ -218,8 +221,12 @@
 
             if (my $hook = $hooks{$handler}) {
                 next if $not_ap_hook{$hook};
+
+                my $order = $not_request_hook{$hook} ? 'APR_HOOK_FIRST'
+                                                     : 'APR_HOOK_REALLY_FIRST';
+
                 push @register_hooks,
-                  "    ap_hook_$hook($name, NULL, NULL, APR_HOOK_FIRST);";
+                  "    ap_hook_$hook($name, NULL, NULL, $order);";
             }
 
             my($protostr, $pass) = canon_proto($prototype, $name);

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to