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

[cgiapp] Re: Yet another callback system proposal


On 2005-05-20, Michael Graham <suppressed> wrote:
>>
>> 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.

It's an interesting idea, but brings up more questions for me. One place
could try to register 'DATABASE' as 10 as and another as '11'.  That
would have to be an error, because 'DATABASE' would no longer refer to a
unique location. 

It would seem that the numbers could be removed and replaced with an
ordered list that services are used in:

  init
  config
  database
  session
  logging 

  logging  teardown
  session  teardown
  database teardown

Of course, CGI::App already has some of this with its various stages of
execution. 

Where this is heading seems suspiciously like Stephen Howard's
Application::Pipeline and WWW::Pipeline modules:

http://search.cpan.org/~howars/Application-Pipeline-0.1.1/lib/Application/Pipeline.pm

I felt that approach was too abstracted at the time, but it includes
features which now seem desirable for CGI::Application:
  - Plugin support via callbacks
  - The ability to define new named execution stages 

It seems worth a look as fuel for the discussion if you haven't reviewed
it recently. 

    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.