On 2004-09-23, Cees Hek <[EMAIL PROTECTED]> wrote:
> Hi Mark,
>
> Just wondering if anyone thinks the multiple hooks patch that I provided
> back in February is still worthwhile. here is the relevant thread:
>
> http://www.jsw4.net/info/list-archives/cgiapp/04-02/msg00034.html
>
> This is something that will be very helpful (if not required) for the
> Auth plugin that I am working on. The Auth plugin needs to run some
> code at the prerun stage, and I would rather have it done automatically
> by the plugin then to have to require the programmer to add code to
> their prerun method manually (that defeats the purpose of the plugin...)
>
> If the patch referenced in the message above doesn't patch cleanly
> anymore, I would be willing to look at it again.
Cees,
I think it's still an interesting an idea, and I'm seen it come up
several times in discussion since then. I'm not opposed to it, I just
feel conservative about moving it directly to CGI::Application proper.
I think it would rather see it released separately, let people play it
and get a feel for it, and then consider merging into the main
code-line. If you have a plug-in that uses it as an example, I think
that would go even further to speed adoption.
I have also thought of some more concrete feedback that I think would
ease my mind about the addition:
- I think it's important to be able to view what all the hooks are doing
and in what order. Here's a "use case". Say that the feature becomes
popular, and I'm using three plug-ins that have registered hooks in
my pre-run mode. I see some strange behavior that I think is related.
How do I debug that?
I think there should be addition or option to dump() that prints out
all the hooks in the order they are called in.
I think I like the explicitness of programmers needed to add a line
or two of code at a particular stage to make a plugin work. It
makes it much clearer to someone browsing the code what is going on,
and in what order.
When hooks are registered, the process is more convenient to set up,
but I'm afraid it my be more difficult to debug and cause confusion.
Perhaps an explicit example of a plug-in using it would cure me of
this. :)
- I wonder if the REALLY_FIRST, FIRST... position system could be
simplified/improved. The way I think about it, either want you
plug-in to run at one of three times at a particular stage:
- before everything else
- after everything else
- you don't care.
Here's an idea for an alternative:
Just use a simple array at each stage. You can append to either
end if you want to try to be really first or really last, or do
either if you don't care.
If know you some plug-in needs to be "really first" or "really last",
"use" it after the other ones, causing it to be last thing added to
one end of the array.
As it is, I find the names very confusing. "middle" doesn't seem
useful, "first" is not really first, and even "really first" is only
a suggestion, since more than one thing can register there! Those
names don't work for me.
Mark
---------------------------------------------------------------------
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]