> Any reason why this is bad?

I've found one - only works if you use PerlRequire.
PerlPostConfigRequire happens too late in the process.

So instead, I've just forced childinit() to be called whether or not you
use connect_on_init and reset the cache there.

So in MP2, connect_on_init becomes a no-op.  Does this have a
significant impact on child startup times? I wouldn't have thought so.


--- Apache/DBI.pm.orig  2006-01-29 01:41:55.000000000 +0100
+++ Apache/DBI.pm       2006-01-29 01:43:34.000000000 +0100
@@ -11,6 +11,8 @@
         require mod_perl2;
         require Apache2::Module;
         require Apache2::ServerUtil;
+        my $s = Apache2::ServerUtil->server;
+        $s->push_handlers(PerlChildInitHandler => \&childinit);
     }
     elsif (defined $modperl::VERSION && $modperl::VERSION > 1 &&
         $modperl::VERSION < 1.99) {
@@ -45,13 +47,7 @@
 sub connect_on_init {
     # provide a handler which creates all connections during server startup

-    if (MP2) {
-        if ([EMAIL PROTECTED]) {
-             my $s = Apache2::ServerUtil->server;
-             $s->push_handlers(PerlChildInitHandler => \&childinit);
-        }
-    }
-    else {
+    unless (MP2) {
         carp "Apache.pm was not loaded\n" and return unless $INC{'Apache.pm'};
         if ([EMAIL PROTECTED] and Apache->can('push_handlers')) {
             Apache->push_handlers(PerlChildInitHandler => \&childinit);
@@ -188,6 +184,7 @@
 sub childinit {
     my $prefix = "$$ Apache::DBI            ";
     print STDERR "$prefix PerlChildInitHandler \n" if $Apache::DBI::DEBUG > 1;
+    %Connected = ();
     if (@ChildConnect) {
         for my $aref (@ChildConnect) {
             shift @$aref;


________________________________________________________________________

Clinton Gormley [EMAIL PROTECTED]

www.TravelJury.com - For travellers, By travellers



Reply via email to