perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [mp2] why Apache::PerlSections gets resolved so many times?
Date Tue, 28 Dec 2004 15:40:39 GMT
Philippe M. Chiasson wrote:
> Stas Bekman wrote:
> 
>> Philippe M. Chiasson wrote:
>>
>>> Stas Bekman wrote:
>>>
>>> [...]
>>>
>>> I've traced it down to this line :
>>>
>>>        handler = modperl_handler_new(p, handler_name);
>>>
>>> So basically, to be able to use the existing modperl_handler_* 
>>> framework to
>>> run <perl> sections, I am creating a brand new handler for each section,
>>> creating that behaviour.
>>
>>
>> But can you arrange for it not to think that it wasn't resolved yet, 
>> keeping things as they are?
> 
> 
> Not sure I follow you there. In most case, there will be only one 
> handler, but
> there might be multiple ones, and I'd want to make sure to create one 
> and only
> one handler for each of them.

Only one? That doesn't seem to be the case. It creates a new handler on 
every <Perl> section.

The module Apache::PerlSections is loaded only one, it's the tracing 
message that was misleading.

> How do you see that as possible ?

I'll fix the tracing. But I've also played a bit to speed things up a bit 
and save some memory (see [1]), but I'm not sure whether this is worth the 
maintenance overhead.

In any case, why the handler is not freed when <Perl> section is done?
Is parms->pool freed when config phase is over? If it is then this effort 
is certainly moot.

[1]
Index: src/modules/perl/modperl_cmd.c
===================================================================
--- src/modules/perl/modperl_cmd.c	(revision 123453)
+++ src/modules/perl/modperl_cmd.c	(working copy)
@@ -554,6 +554,20 @@
          SV *saveconfig = MP_PERLSECTIONS_SAVECONFIG_SV;
          AV *args = Nullav;

+        /* resolve the handler here w/o going through
+         * modperl_handler_resolve, so it will be faster and memory
+         * will be saved (e.g. handler dup is avoided)
+         */
+        modperl_require_module(aTHX_ handler->name, TRUE);
+        handler->mgv_obj = modperl_mgv_new(p);
+        handler->mgv_obj->len = strlen(handler->name);
+        handler->mgv_obj->name =
+            apr_pstrndup(p, handler->name, handler->mgv_obj->len);
+        handler->mgv_cv = modperl_mgv_compile(aTHX_ p, handler->name);
+        modperl_mgv_append(aTHX_ p, handler->mgv_cv, "handler");
+        MpHandlerPARSED_On(handler);
+        MpHandlerMETHOD_On(handler);
+
          modperl_handler_make_args(aTHX_ &args,
                                    "Apache::CmdParms", parms,
                                    "APR::Table", options,

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

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


Mime
View raw message