On Sat, Sep 25, 2004 at 02:00:08AM +1000, Cees Hek wrote: > The terminology is somewhat confusing, and I've confused myself a couple of > times while writing these messages to the list :). Here is how I see it:
Glad to know it's not just me :). Thanks for the concise explanation. The example you provided really helped clear things up for me. I guess programmers can read code better than language; or perhaps codes has more depth of meaning than expositions. > A hook is a place in the execution path of a program where you can execute a bit > of your own code. So the cgiapp_init and cgiapp_prerun methods are examples of > hooks into the execution path of a CGI::App program. We are looking to add the > ability to execute multiple bits of code at each hook. I prefer to think of > these bits of code as callbacks. So we can register multiple callbacks at each > hook. We also want to be able to specify the order that the callbacks get > executed in. So we have hooks that contain callbacks which execute in some order (one of default, first or last). > I think it might clear things up if we actually call the hooks like > this (init prerun postrun teardown)... +1 > So as an example, the cgiapp_prerun callback will automatically be registered at > the prerun hook with the default ordering (DONTCARE). > > Now if later on in the code another callback is registered at the prerun hook, > it could be done like this: So this would allow existing code that overrides the callback subroutine to work while allowing new callbacks to be added. Nice! Now I'm starting to grok this addition. I think it would be helpful in your documentation update to include a use case. Here's why: under "normal" operation, should a programmer override the cgiapp_init subroutine or add a new callback? My guess is to stick with existing behavior. What's your opinion? > I hope that clarifies the terminology a little bit. I am in the process of > solidifying these ideas in a couple of new plugins, and I hope to have these > available soon. Looking forward to it. William -- Knowmad Services Inc. http://www.knowmad.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]
