You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Ruslan U. Zakirov" <cu...@wr.miee.ru> on 2003/01/13 18:32:43 UTC

Inserting a handler in "stack of handlers".

Hello All!
Short synopsis:
      How to push handler just after handler that working now?
More about the problem.
     I've got main handler, that forms stack of handlers from query string
by calling push_handlers(). Then each module doing his job. Some handlers
needs to put another hook just after they end thier job. I do it with
direct call to SomeModule::handler($r), it works for me, but it's rude
back(as i think). I've tried to do the same with push_handlers, but this
function push handlers only at the end of handler's list and content appears at
the bottom of page :(
Any suggestion?
    Best regards, Ruslan.


Re: Inserting a handler in "stack of handlers".

Posted by "Ruslan U. Zakirov" <cu...@wr.miee.ru>.
SB> Geoffrey Young wrote:
>> Ruslan U. Zakirov wrote:
>>> Hello All!
>>> Short synopsis:
>>>       How to push handler just after handler that working now?
>>> More about the problem.
>>>      I've got main handler, that forms stack of handlers from query 
>>> string
>>> by calling push_handlers(). Then each module doing his job. Some handlers
>>> needs to put another hook just after they end thier job. I do it with
>>> direct call to SomeModule::handler($r), it works for me, but it's rude
>>> back(as i think). I've tried to do the same with push_handlers, but this
>>> function push handlers only at the end of handler's list and content 
>>> appears at
>>> the bottom of page :(
>>> Any suggestion?
>>>     Best regards, Ruslan.
>> you can't really do this now I don't think.  generally, the way would be
>> to use get_handlers() to get the current chain, then use set_handlers() 
>> to set it to what you want it to be (inserting logic to splice the added 
>> handler where you want it).  unfortunately, you can't call 
>> set_handlers() for the current phase, so adding another handler right 
>> after the current one runs probably isn't possible.
SB> That should probably be possible in 2.0, but it's not implemented yet.
SB> Patches are welcome.
Thanks.
Sorry, but I don't have time to look in mod_perl/Apache code.
Good product. I think it'll be better and hope that it'll be more
flexible in some cases.
         Thanks, Ruslan.


Re: Inserting a handler in "stack of handlers".

Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
> 
> 
> Ruslan U. Zakirov wrote:
> 
>> Hello All!
>> Short synopsis:
>>       How to push handler just after handler that working now?
>> More about the problem.
>>      I've got main handler, that forms stack of handlers from query 
>> string
>> by calling push_handlers(). Then each module doing his job. Some handlers
>> needs to put another hook just after they end thier job. I do it with
>> direct call to SomeModule::handler($r), it works for me, but it's rude
>> back(as i think). I've tried to do the same with push_handlers, but this
>> function push handlers only at the end of handler's list and content 
>> appears at
>> the bottom of page :(
>> Any suggestion?
>>     Best regards, Ruslan.
> 
> 
> you can't really do this now I don't think.  generally, the way would be 
> to use get_handlers() to get the current chain, then use set_handlers() 
> to set it to what you want it to be (inserting logic to splice the added 
> handler where you want it).  unfortunately, you can't call 
> set_handlers() for the current phase, so adding another handler right 
> after the current one runs probably isn't possible.

That should probably be possible in 2.0, but it's not implemented yet. 
Patches are welcome.


__________________________________________________________________
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


Re: Inserting a handler in "stack of handlers".

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Ruslan U. Zakirov wrote:
> Hello All!
> Short synopsis:
>       How to push handler just after handler that working now?
> More about the problem.
>      I've got main handler, that forms stack of handlers from query string
> by calling push_handlers(). Then each module doing his job. Some handlers
> needs to put another hook just after they end thier job. I do it with
> direct call to SomeModule::handler($r), it works for me, but it's rude
> back(as i think). I've tried to do the same with push_handlers, but this
> function push handlers only at the end of handler's list and content appears at
> the bottom of page :(
> Any suggestion?
>     Best regards, Ruslan.

you can't really do this now I don't think.  generally, the way would be to 
use get_handlers() to get the current chain, then use set_handlers() to set 
it to what you want it to be (inserting logic to splice the added handler 
where you want it).  unfortunately, you can't call set_handlers() for the 
current phase, so adding another handler right after the current one runs 
probably isn't possible.

HTH

--Geoff