httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject dynamic hook ordering
Date Thu, 10 Jun 2004 00:19:00 GMT
hi all

I wanted to ping everyone about an idea I've been throwing around for a few
months now.  I'd like the ability to shuffle the declared hook ordering
around, most likely during the post-config phase.

basically what I would like to be able to do is shift a hook from one place
(say, HOOK_FIRST) to another.  there are a few reasons I want to be able to
do this, and most stem from some things I want to be able to do with
mod_perl, but I'll go into that rationale later if someone asks :)

putting reasons aside for the moment, here is a proof of concept module that
kind of does what I'm after.

  http://perl.apache.org/~geoff/hook_order-test.tar.gz

the main logic is in mod_hook_order.c, where it basically takes every
mod_perl hook (which are by default registered as REALLY_FIRST) and moves
them to HOOK_LAST during post-config.  you can run the module if you have a
mod_perl enabled server and Apache-Test installed, but the code is fairly
straightforward (and largely stolen from mod_info).

all in all, it's a fairly simple thing to do, but it makes a few things
possible, most interestingly the ability to create a configuration directive
that would allow users to choose the ordering of core processing the way
they used to be able to in 1.3 (a la ClearModuleList/AddModule and without
editing the source).  another problem it might help to solve is when module
writers encounter a situation where another module is registered
REALLY_FIRST or REALLY_LAST and they want the spot.  currently, I don't see
any formal way to claim those spots for yourself except registering yourself
as, say, REALLY_LAST + 10 or something.

anyway, what I would like to try to do is take the logic in the prototype
and create a formal apr_hook_get()/apr_hook_set() API that allows people
access to the data that is there.  an additional need would be to require
each call to ap_hook_* to have a name for the hook as well, since modules
can register mutliple callbacks for the same phase but there is no way to
distinguish one callback from another in the current design.

so, before I get started down the path of a bit of work, comments appreciated.

--Geoff

Mime
View raw message