Re: get_handlers and set_handlers - purpose and use cases?

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Tue, Mar 23, 2010 at 2:54 PM, Michael Ludwig <[email protected]> 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.

> 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.

> 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.

- Perrin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.