Perrin Harkins schrieb am 23.03.2010 um 15:14:56 (-0400):
> On Tue, Mar 23, 2010 at 2:54 PM, Michael Ludwig <mil...@gmx.de> wrote:
> >  # A list of handlers configured to run at the response phase:
> >  my @handlers = @{ $r->get_handlers('PerlResponseHandler') || [] };
> >
> > Now what do I do with that bunch of code references? I think there
> > might be something useful about this that escapes me.
> 
> If you want to know what handlers are set to run for the current
> request, this is how you find out.

Well, you don't - unless you can tell from the code reference which
handler it actually is. With code reference, ususally you have to know
(or do not care) what reference it is. It is only when you call it that
you find out.

> > Almost the same story for set_handlers: Do people use this to
> > dynamically reconfigure their server? Could it be used to
> > dynamically take a handler out of service once a certain error
> > condition is met with, like, say, a Berkeley database in need of
> > recovery (which requires single-threaded access to perform), or a
> > search engine backend having become irresponsive?
> 
> More likely you would use them to do your own dispatch of some kind
> where you choose between multiple possible handlers based on something
> about the request.

Okay, I can see that for the case of setting a handler on the current
request. But I figure it can get pretty confusing if you reconfigure
your server by calling set_handlers on the Apache2::ServerRec object as
shown here:

http://perl.apache.org/docs/2.0/api/Apache2/ServerUtil.html

How do people keep track of who configured what handlers, and what is
the current handler? I would have to receive a name in addition to the
code ref from get_handlers in order to determine the current state of
affairs. So how is this used in practice? Or isn't it?

> > What have you used these functions for in real code?
> 
> Sometimes people use them to tell apache to handle a certain request
> as a static file and skip the mod_perl response handler that would
> normally be configured for the URI.

That makes sense, but I would rather have taken care to ensure that only
properly dynamic requests hit mod_perl. Thanks nonetheless. But I'm
still eager to learn more :-)
-- 
Michael Ludwig

Reply via email to