perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Issac Goldstand <>
Subject dynamically loading hooks
Date Tue, 26 Sep 2006 08:01:48 GMT
Hi all,
  I wanted to follow-up a bit on a thread that was on the main list 
regarding hooking new hooks (I think there it was suexec_id).  I deleted 
the original posts and don't have "proper" access now to make an elegant 
response, but I wanted to share the idea before I forget it and see if 
someone here could shape it a bit better.  It occurred to me that it may 
be possible to allow for dynamic hooking to a very large extent by using 
dlsym (or some equivalent trick) to turn a string into a function 
pointer in C.  If we could pull that off, it shouldn't be so difficult 
to allow additional hooks to be hooked in the post_config stage.  While 
this wouldn't work for everything, we could pre-create maps for the 
common argument data types (request_rec, server_rec, int, void) and that 
should give us enough to let the user dynamically hook hooks in the 
config.  The configuration directive might look like:

PerlAddHook HookName Some::Module::hook ReturnType ArgCount ArgTypes 
[ArgTypes is limited to predefined allowed types which will be converted 
to the corresponding perl structures]

This even gives us a minor speed boost of not requiring all hooks to be 
hooked to further reduce overhead (since I seem to recall that Stas and 
Doug went to a lot of effort to shave off everything that could be shaved).

Again, this is really more of a brainstorm than a matured 
idea/suggestion, but wanted to get it off my chest :-)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message