[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Re: Yet another callback system proposal


Mark Stosberg <suppressed> wrote:

> > Well, I was pretty conservative (read: timid) in my numbering.  We could
> > obviously change it to:
> >
> >     FIRST         => 1
> >     MIDDLE        => 50
> >     DONTCARE      => 50
> >     LAST          => 100
> >
> > Then the names don't lie, and people can use the numbers if they
> > really need precise control.
>
> I don't think numbers really help with precise control, because the
> control desired is to have an affect on loading position relative to
> other plugins which we are out of your control.

Here's a wacky idea:

What if plugins could register position names as well as callbacks?
The application (or project, or framework) would do something like the
following at compile time:

    $class->add_named_callback_position('DATABASE' => 10);
    $class->add_named_callback_position('CONFIG'   => 5);

Then the other modules needing callbacks could do something like the
following at import time:

    $caller->add_callback('init', 'my_setup', 'DATABASE');

I know there are issues with this (e.g. you've got to be careful to add
the positions before you use them).  I'm just throwing it out there as
an idea.


Michael




-----------------------------------------------------------------------
Michael Graham <suppressed>

YAPC::NA 2005 Toronto - http://www.yapc.org/America/ - suppressed
-----------------------------------------------------------------------


---------------------------------------------------------------------
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.