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

Re: [cgiapp] Yet another callback system proposal


On 5/11/05, Michael Graham <suppressed> wrote:
> 
> Hmmm, thinking about it today, maybe the following syntax would make
> more sense?
> 
>   package MyPlugin;
>   sub import {
>       my $caller = scalar(caller);
>       $caller->add_callback('init', 'my_setup', 'FIRST');
>       goto &Exporter::import;
>   }

Yes, I like that a lot better.

I haven't had a chance to take a really close look at the patch, but
from what you describe, and from my brief look at it, this will solve
most if not all of the outstanding problems I discovered with my
original callbacks patch.

I won't be able to take a close look at it until next week, so
hopefully someone else can take some time to look it over and play
with it.

Thanks for getting this discussion started again.  I had been meaning
to get back to it again, but have been too busy lately.

Cheers,

Cees

> That way we can make the positional parameter optional:
> 
>   package MyPlugin;
>   sub import {
>       my $caller = scalar(caller);
>       $caller->add_callback('init', 'my_setup');
>       goto &Exporter::import;
>   }
> 
> It will make the docs simpler, because you can say "any callbacks
> installed on behalf $self or superclasses of $self."
> 
> It also makes it more convenient for apps to install callbacks, because
> they can just say
> 
>   $self->add_callback('teardown', 'foo');
> 
> same as they would have done with the object-based callback mechanism.
> 
> 
> 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
> 
>

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