You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Dorian Taylor <do...@foobarsystems.com> on 2005/02/01 02:23:12 UTC

[mp2] retrieving the calling handler

how would i go about retrieving (mod_perl or otherwise) the name
of the immediate calling handler of the current handler being
executed?

i'm trying to do loop checking in which a given handler may need
to be executed as a result of multiple subrequests, but never back
to back.

e.g.:

# httpd.conf ... 

# mod_transform uses an output filter to trap the content of a response
# it lives at http://www.outoforder.cc/projects/apache/mod_transform/docs/
LoadModule transform_module modules/mod_transform.so

# Apache::MyStuff cleans up uri->filename stuff 
<Location /foo>
PerlTypeHandler Apache::MyStuff
AddOutputFilter XSLT .xml
</Location>

so, the scenario here is that mod_transform needs to subrequest its
external entities. these external entities need to be able to run
once through the type handler, but only once, as the type handler
will loop indefinitely. the timeline goes as such:

* request comes in from a browser, or possibly a subrequest.

* Apache::MyStuff examines uri.

* Apache::MyStuff may run a lookup_uri here or there (these do not trigger 
  Apache::MyStuff's handler because some sort of state is set).

* http_core (or whatever) serves up a resource, probably xml.

* if it's xml, mod_transform picks up and starts trying to dereference 
  the external entities using its filter to trap the output.

* as entities are being dereferenced, Apache::MyStuff is called once again 
  as if the subrequest lookup generated by the entity dereference
  was an external request.

so anyway, what i'm trying to figure out is how to set a state in
a handler temporarily, so that subrequests spawned from it and it
only do not cause it to recurse, but if it's invoked as a subrequest
or internal redirect from another handler, it does its job.

if anyone can suggest anything, i'd be greatly appreciative.

thanks

.d

Re: [mp2] retrieving the calling handler

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Dorian Taylor wrote:
> how would i go about retrieving (mod_perl or otherwise) the name
> of the immediate calling handler of the current handler being
> executed?
> 
> i'm trying to do loop checking in which a given handler may need
> to be executed as a result of multiple subrequests, but never back
> to back.

There was someone with a similar problem just a while ago:

http://gossamer-threads.com/lists/modperl/modperl/77721

I believe it is relevant to your question.

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5