Geoffrey Young wrote:

I would want at least a real-time interface for this, something similar to

$filter->init(sub {shift->update_mtime($package_mtime)} );


where would you run this code?

outsite of a handler() subroutine, pretty much like I showed it - on module load. I suspect you'd have to register the init handler that way for a few reasons, namely that you'd miss the first request if you waited until after default_handler runs to register your init filter. it's also good to do it outside of handler() to handle stuff like reloads, where the init routine might use a closure to avoid recalculating the package mtime on each request.
The problem is that currently the resolving (read: module compiling and handler resolving) is postponed till the first invocation of the handler unless the module was manually preloaded or PerlOptions +Autoload was set.
I suppose that this could be a documented thing. e.g.:

if you use filter_init, you must preload the module at the server startup.

I'm not sure what that means for actually getting at the filter object outside of a request :)
I don't think that's how it'll work. I was thinking of having a subroutine with a special attribute. So after the module has been compiled we can walk through all the CODE entries and check whether any of them is having the FilterInitHandler attribute and take it from there. Does this sound good?

if you come up with the interface, I'll write the tests to make sure it does what we need.


Cool.

Is there some C module that uses that hook so I can look at it? I guess somewhere in PHP, because I don't seem to see any in the core modules.

yeah, the bug report points to PHP. it also mentions mod_include, but I haven't looked at it yet.
I read the thread at the URL you've provided. The latest comment from Dec says that the bug is still there. So I suppose that the feature was added but not really used so far. I could be wrong.

I'll try to look into this a bit more next week.
Cool. Thanks Geoff!

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to