perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: ModPerl::MethodLookup questionalbe recommendation
Date Fri, 29 Jul 2005 00:13:43 GMT


Vivek Khera wrote:
> I'm converting my main app to mp2.  The following advice seems 
> incorrect to me:
> 
> % perl -MModPerl::MethodLookup -e print_method is_main
> 'is_main' is not a part of the mod_perl 2.0 API
> use 'main' instead.  not in the Apache 2.0 API
> To use method 'main' add:
>         use Apache2::RequestRec ();
> 
> 
> I believe the more appropriate replacement of is_main() would be 
> is_initial_req() from Apache2::RequestUtil().

in 1.3 is_main() was used to specify the initial request in a series of
subrequests.  is_initial_req() specifies _only_ the initial request coming
from the client.  in other words, a single browser request results in one
and only one place where is_initial_req() is true, while it could
potentially create several instances where is_main() is true.

so... way back in the day people used to use $r->is_main() to spot the place
where they could, say, call $r->notes and get the "main" request.  in mp2 I
guess you would do $r->main->notes and avoid the call to is_main() at all.

anyway, I guess all I'm saying is that I don't think is_initial_req() ought
to be the replacement for is_main() - is_initial_req() is very specific and
still exists with the same functionality in 2.0.  if someone was using
is_main() in mp2 it's not necessarily true that is_initial_req() is what
they need.

of course main() isn't what they need either...

:)

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message