Re: Minor patch to fix ApacheHandler.pm to work under recent mod_perl 2.0

John Williams <[email protected]> Tue, 21 Jun 2005 11:52:07 -0600 (MDT)
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
Well, I should have tried the tests myself, before spouting off an email.
Mentioning Apache2::ServerUtil would fix the problem.

The problem is caused by this change in r1.326

Dave Rolsky:
I assume you had a reason for doing this, but
   eval { _get_apache_server() }
always fails here within the begin block, because the _get_apache_server
is not defined until later in the file.  (And we really should require
Apache or Apache2::ServerUtil before calling _get_apache_server.)

I will back out the change for now.

~ John Williams


@@ -218,17 +219,19 @@
 use constant REDIRECT	=> 302;

 BEGIN {
-	if (APACHE2) {
-		require Apache2::RequestRec;
-		require Apache2::RequestIO;
-		require Apache2::ServerUtil;
-		require Apache2::RequestUtil;
-		require Apache2::Log;
-		require APR::Table;
-	} else {
-		require Apache;
-		Apache->import();
-	}
+    if ( eval { _get_apache_server() } ) {
+        if (APACHE2) {
+            require Apache2::RequestRec;
+            require Apache2::RequestIO;
+            require Apache2::ServerUtil;
+            require Apache2::RequestUtil;
+            require Apache2::Log;
+            require APR::Table;
+        } else {
+            require Apache;
+            Apache->import();
+        }
+    }
 }

 unless ( APACHE2 )

On Tue, 21 Jun 2005, Christopher Nehren wrote:

> On Tue, Jun 21, 2005 at 12:44:23 EDT, John Williams scribbled these
> curious markings:
> > What are the circumstance under which this is needed?
> >
> > make_ah is called by the handler function, so it should always have a
> > valid $r.
>
> Hmm. It fixed things last night, but this is before I had
> Apache2::RequestUtil in my startup file. I didn't think I needed to have
> that mentioned (as I see 'require Apache2::RequestUtil' towards the top
> of ApacheHandler.pm). Now that I have Apache2::RequestUtil in my startup
> file, my patch isn't needed. Please disregard it, I guess. And thanks
> for the great work on making Mason work under Apache 2! I've been
> searching for an actually-supported Perl embedding system for Apache 2
> for a long time (I've had problems reaching Beau Cox).
>
> Best regards,
> Christopher Nehren
>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click