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

Re: [cgiapp] Yet another callback system proposal


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;
  }

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


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.