You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Paul J. Reder" <re...@raleigh.ibm.com> on 2000/11/28 22:51:58 UTC

Question about hooks in mod_include.

Ryan,

You mentioned using hooks in mod_include (ala experimental/mod_cache) to allow
modules to register handle_x functions with mod_include.

I am confused by this for the following reason. As I understand it, this would
create a hook list of module functions that mod_include would run (via
ap_run_hook...) when it found an SSI. Each registered hook function would get
a shot until one of them handled the SSI.

This doesn't allow for the registration with mod_include of a hashable "directive
token"/handler_x function pair for quick access and extendibility.

Unless you are talking about something like allowing the modules to register a
hook function early in the process which will perform the directive registration
with mod_include when the hook is run by mod_include later in the init processing.
This seems unnecessarily complex.

It seems to me that what we need is an exported function in mod_include that
gets called from other modules that would like to register a directive/function
pair (i.e.. register_include_handler("perl", handle_perl); where handle_perl is
a function in the perl code that can handle perl SSI directives). Mod_include would
then insert the function into the hash table using the directive as the key.

Where am I not understanding the hook code?

-- 
Paul J. Reder
-----------------------------------------------------------
"The strength of the Constitution lies entirely in the determination of each
citizen to defend it.  Only if every single citizen feels duty bound to do
his share in this defense are the constitutional rights secure."
-- Albert Einstein

Re: Question about hooks in mod_include.

Posted by Greg Stein <gs...@lyra.org>.
We already have a pattern/precedent for this. mod_dav exports some
registration functions, and filter registration functions. In both cases,
these are called by people at "register_hooks" time.

This is cleaner than a module registering a hook (at "register_hooks" time),
then responding to that hook. And when does mod_include run the hook? Don't
say register_hooks time because the other people may not have registered
themselves by that point(!).

Ryan's idea of the hash table registration process is a Good Idea, but let's
export a registration function that people call during their register_hooks
module slot.

Cheers,
-g

On Tue, Nov 28, 2000 at 02:21:51PM -0800, rbb@covalent.net wrote:
> 
> You have the idea correct mostly.  The hook is used to allow modules to
> register their functions with the hash table.  The reason for the hook, is
> that it makes things a bit clearer for the module writers.  Basically, if
> mod_include just exports the function, then when do include_modules call
> that function?  The explicit hook just makes it very obvious as to when
> those functions should be registered.
> 
> Ryan
> 
> On Tue, 28 Nov 2000, Paul J. Reder wrote:
> 
> > Ryan,
> > 
> > You mentioned using hooks in mod_include (ala experimental/mod_cache) to allow
> > modules to register handle_x functions with mod_include.
> > 
> > I am confused by this for the following reason. As I understand it, this would
> > create a hook list of module functions that mod_include would run (via
> > ap_run_hook...) when it found an SSI. Each registered hook function would get
> > a shot until one of them handled the SSI.
> > 
> > This doesn't allow for the registration with mod_include of a hashable "directive
> > token"/handler_x function pair for quick access and extendibility.
> > 
> > Unless you are talking about something like allowing the modules to register a
> > hook function early in the process which will perform the directive registration
> > with mod_include when the hook is run by mod_include later in the init processing.
> > This seems unnecessarily complex.
> > 
> > It seems to me that what we need is an exported function in mod_include that
> > gets called from other modules that would like to register a directive/function
> > pair (i.e.. register_include_handler("perl", handle_perl); where handle_perl is
> > a function in the perl code that can handle perl SSI directives). Mod_include would
> > then insert the function into the hash table using the directive as the key.
> > 
> > Where am I not understanding the hook code?
> > 
> > -- 
> > Paul J. Reder
> > -----------------------------------------------------------
> > "The strength of the Constitution lies entirely in the determination of each
> > citizen to defend it.  Only if every single citizen feels duty bound to do
> > his share in this defense are the constitutional rights secure."
> > -- Albert Einstein
> > 
> > 
> 
> 
> _______________________________________________________________________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> -------------------------------------------------------------------------------
> 
> 
> 

-- 
Greg Stein, http://www.lyra.org/

Re: Question about hooks in mod_include.

Posted by rb...@covalent.net.
You have the idea correct mostly.  The hook is used to allow modules to
register their functions with the hash table.  The reason for the hook, is
that it makes things a bit clearer for the module writers.  Basically, if
mod_include just exports the function, then when do include_modules call
that function?  The explicit hook just makes it very obvious as to when
those functions should be registered.

Ryan

On Tue, 28 Nov 2000, Paul J. Reder wrote:

> Ryan,
> 
> You mentioned using hooks in mod_include (ala experimental/mod_cache) to allow
> modules to register handle_x functions with mod_include.
> 
> I am confused by this for the following reason. As I understand it, this would
> create a hook list of module functions that mod_include would run (via
> ap_run_hook...) when it found an SSI. Each registered hook function would get
> a shot until one of them handled the SSI.
> 
> This doesn't allow for the registration with mod_include of a hashable "directive
> token"/handler_x function pair for quick access and extendibility.
> 
> Unless you are talking about something like allowing the modules to register a
> hook function early in the process which will perform the directive registration
> with mod_include when the hook is run by mod_include later in the init processing.
> This seems unnecessarily complex.
> 
> It seems to me that what we need is an exported function in mod_include that
> gets called from other modules that would like to register a directive/function
> pair (i.e.. register_include_handler("perl", handle_perl); where handle_perl is
> a function in the perl code that can handle perl SSI directives). Mod_include would
> then insert the function into the hash table using the directive as the key.
> 
> Where am I not understanding the hook code?
> 
> -- 
> Paul J. Reder
> -----------------------------------------------------------
> "The strength of the Constitution lies entirely in the determination of each
> citizen to defend it.  Only if every single citizen feels duty bound to do
> his share in this defense are the constitutional rights secure."
> -- Albert Einstein
> 
> 


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------