On 2005-05-11, Michael Graham <suppressed> wrote:
>
> Okay, here's a new approach to callbacks that solves the same issues,
> but doesn't require a Plugin base class.
Thanks for taking an interest in this Michael.
While I've come to see the value of callbacks, I rarely need to use them
myself, so it's been somewhat difficult for me to evaluate them.
Your feedback is helpful.
I'm interested to see what feedback Cees will have, but here is a little
of my own.
> In a persistent environment, there might be a lot of applications
> in memory at the same time. For instance:
I'm glad you considered this case.
> I have also changed the position scheme. Instead of limiting the
> positions to 'REALLY_FIRST', 'FIRST', 'MIDDLE', 'LAST', and
> 'REALLY_LAST', you can now specify a numeric position between 0 and 100.
>
> The named positions are still available, but they are aliases for
> numeric positions:
>
> REALLY_FIRST => 5
> FIRST => 15
> MIDDLE => 50
> DONTCARE => 50
> LAST => 85
> REALLY_LAST => 95
>
> So, the following two calls are equivalent:
>
> CGI::Application->add_callback('teardown', 'my_fixup', 'LAST', scalar(caller));
> CGI::Application->add_callback('teardown', 'my_fixup', 85, scalar(caller));
>
> This gives plugin authors some flexibility in the ordering of their
> callbacks.
I don't like this idea. The position seems already seems a little
over-engineered and muddled. "First" isn't really first, because there's
"really first". Now you are proposing that "really first" isn't really
first either, there are 5 positions before it.
I think "really first" should be "really first" (there should be only
one possible occupant for this position or it's an error).
I think five positions should be sufficient to start with, and a finer
grained layer can be added later if the need is proven.
If the plugin loading becomes complex, it probably won't be numeric
slots that will be most helpful, but being able to express something in
terms a human could actually understand, like "this needs to be loaded
after the database handle is available".
Mark
--
http://mark.stosberg.com/
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.