I'm having some frustration with managing Perl handler registrations.

It seems that, if I register a handler from within my code, either using
push_handlers or by grabbing the list with get_handlers, modifying it,
and then doing set_handlers -- any other handlers for that phase that
were registered in httpd.conf with Perl*Handler are dropped and never
called.

So if, in a PostReadRequestHandler, I do

 $r->push_handlers('PerlFixupHandler',\&foo);

Then anything in httpd.conf like

 PerlFixupHandler Module::foo

never happens.  The same result occurs if I do get_handlers, add my
handler to the list, and then put it back with set_handlers.

I can't seem to find a way around this; what I'm looking for is a way
to say "add this handler to the list of handlers", not "replace the
list of handlers with this".

The only idea I've come up with is to basically re-implement the entire
functionality myself -- write a module that has PostReadRequest and
HeaderParser handlers, registered in httpd.conf; create my own Apache
config directives that take handlers; maintain the entire list of
handlers myself; and never use Perl*Handler directives for anything.

This would have the added benefit of fixing the problem where Perl*Handler
directives in <Location> and other containers override the ones in their
parents rather than adding to them (which leads to a complicated maze of
config directives to maintain, where getting one wrong breaks everything).
I could export an API for other modules to register handlers.  And I could
probably even implement allowing a module to unconditionally register a
handler just by virtue of being loaded, like a C module, which I've wished
for more times than I care to count.  It also wouldn't be difficult.  But
it has the drawback of seeming very silly, and I figure that must mean I'm
missing something.

So, what am I missing?  Is there a portion of the docs I somehow overlooked?
I'm perfectly willing to feel silly for even asking, if I actually find an
answer to this problem. :)

-- 
Jeremy  |  [EMAIL PROTECTED]

Reply via email to