Cees --

On 2004-12-21, Cees Hek <[EMAIL PROTECTED]> wrote:
>> At what stage in the process do callbacks get registered? It seems
>
> callbacks can be registered at any time during the execution of the
> application, up until the point that the stage you are registering to
> is about to be executed.  This means that a teardown callback could be
> registered in the postrun stage if you wanted.  But a prerun callback
> could not be registered from within a runmode, since the prerun stage
> has already finished.  In my original patch there was a check for this
> to make sure you were registering something that was still going to be
> executed.

Could you resurrect that patch? I think it will make things less confusing.

>> obvious that they must be registered before they called. So when would
>> you have a chance to register one that would run in cgiapp_init?
>> 
>> After you have called new(), it's too late.
>
> Yes, this came up in the discussion at one point (many months ago). 
> The user would be able to register something at the cgiapp_init stage
> right after the new(), but I don't think that is very useful (since
> they could just as well run any code they need right there instead of
> registering it at the init stage).
>
> So the init stage is not very usable with regards to callbacks, since
> it runs so early in the process that nothing has time to register
> anything at the init phase.  The reason I put the init phase in there
> was more for completeness sake than anything else.  It felt cleaner to
> me to include all hooks.  There were also questions as to why the
> 'setup' phase was not included.  I left it out, because traditionally
> it is not considered a hook, but a requirement for the runmode module
> to implement.

This does look clean and correct at first glance. But I'd rather 
remove it for now to avoid confusion. It will be easier to possibly 
add it later than it would be to remove it. 

>> Would plug-in users be adding code like this to cgiapp_init?
>
> That is probably the most useful stage to register callbacks, since
> this is where most of the configuration for plugins is happening (at
> least for the plugins that I have developed).

Your examples were really helpful. I may integrate some version of them
into the docs.

Thanks again Cees.

    Mark
-- 
http://mark.stosberg.com/ 


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to