perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boris Zentner <>
Subject Re: [mp2] killing the ghost Apache:: usage?
Date Mon, 19 Jan 2004 09:53:28 GMT
Am Sonntag, 18. Januar 2004 07:14 schrieb Stas Bekman:
> Boris Zentner wrote:
> >>>
> >>>and im sure my next project start with this lines too. If someone ask
> >>> why my answer is I do not know, but it does not work otherwise.
> >>
> >>And that's fine. Think of mp2 as a bunch of CPAN modules. You need to
> >> load them before you can use them.
> >
> > That is fine and reasonable to me. My point is that once I have an object
> > I want to be sure that I can use every method for this object. For
> > example this implies that whenever I have a RequestRec object that can
> > print, I must be sure that I can do so without loading Apache::RequestIO.
> >
> > It is ok to 'use APR::Date' if I like to use a function of it or operate
> > on a object that I can produce. But it is not ok in my opinion that my
> > Apache::RequestRec object gets magical date methods.
> But none of Apache::Request* classes is a subclass of each other. There is
> no inheritance tree. All they do is nicely spread the methods across
> several modules, giving you better fine tuning. So when you get $r in your

That is exactly my objection. It is like AUTOLOAD by hand. 

> handler we have no idea what methods you are going to need, and which
> classes you need to load. It's quite possible that you never going to use
> Apache::RequestRec, so any guessing is wrong.

No guessing need at all. If I never need anything from $r I do not 'use 
Apache::RequestRec'. What I expect is that whenever I have a object of type 
X::Y, I can use every method of that object from the time on where I do a 
'use X::Y;'. Even more I expect that no other modules change this behavior.

And how do you document this? Add a note in Apache::RequestRec for method x 
that can only be used if you use the  Apache::RequestFoo module?  Also in the 
docs for Apache::RequestFoo must be noted that there is no object of type 
Apache::RequestFoo nor any function. And all methods from Apache::RequestFoo 
infurence Apache::RequestRec. Another drawback is that I need a tool that 
tell me which modues I need to use method xyz. This information must be 
manualy transfered into my source. 

This is a big help on migration but a beak for development.

> I think the best solution for your kind of pain is the one that Josh has
> proposed:
>    use Apache::whatever qw(:request);
> and you get all Apache::Request* modules loaded and now you have all the
> mp2 methods that you can operate on $r.

This is nice, but only a workaround for the questionable practice. Im sure 
nearly every module starts with this lines and then the reason for this 
( IMHO save some bytes of nice sharable readonly data )  is completely 
disabled. But it keeps all drawbacks.

If I try to profit, my only save bet is to read the ready source line by line, 
writedown every mp2 method, run the list to mp2method_lookup and type that in 
front of my handler. I do not think that anybody does so in practice.

>    use Apache::whatever qw(:request :server);
> and you get Apache::Request* and Apache::Server* loaded. That is very
> similar to how imports its function interface symbols via tags,
> though here we deal with modules.
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
>     mod_perl Guide --->

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

View raw message