perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: [mp2 patch] ModPerl/ (was Re: [mp2] killing the ghost Apache:: usage?)
Date Fri, 13 Feb 2004 23:04:39 GMT
Joe Schaefer wrote:
> Stas Bekman <> writes:
>>Joe Schaefer wrote:
>>>Stas Bekman <> writes:
>>>>Boris Zentner wrote:
>>>>>Right, but using Apache::Request is not so uncommon.
>>>>May be A-R can be fixed to use a proper inheritance?
>>>Sorry I haven't been paying attention to this thread.
>>>If by "proper inheritance" you mean,  A-R should require
>>>Apache::RequestRec when it's running inside mp2, then
>>>*that* can be fixed easily.
>>Boris was talking about Apache-Request objects not working properly with
>>AUTOLOAD (i.e. the functions lookup isn't getting propagated to AUTOLOAD).
>>A-R should load only classes that it needs and never more.
> In mp2, Apache::RequestRec *is the base class* for A-R (A-R shouldn't
> have any AUTOLOAD methods).  AFAICT that certainly fits the bill as 
> being a necessity. How can a subclass be expected to work properly if 
> its parent modules aren't available?

That's the thing we are trying to solve. You get $r (Apache::RequestRec 
object), but none of the classes is loaded for you (because there are many 
sub-packages that load parts of the API you can call on $r). So we are trying 
the solution of defining Apache::RequestRec::AUTOLOAD which will resolve the 
methods to modules containing them and load the modules behind the scenes as 
they are needed. This is similar to AutoLoader but here we deal with XS modules.

So let's say you do:

sub handler {
   my $r = shift;

w/o explicitly loading Apache::RequestRec. content_type will make its way to
Apache::RequestRec::AUTOLOAD, which will figure out that the method lives in 
the Apache::RequestRec module and load it for you. Of couse if you preloaded 
the module, everything will work w/o going through AUTOLOAD.

Now if $apr (Apache::Request object) is a sub-class of Apache::RequestRec and 
the Apache::RequestRec module wasn't loaded so far. Calling


should try to find Apache::Request::AUTOLOAD and since there is none, go up 
@ISA and find Apache::RequestRec::AUTOLOAD, which will resolve the lookup and 
load the missing module accomplishing the call.

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message