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 <[EMAIL PROTECTED]>

YAPC::NA 2005 Toronto - http://www.yapc.org/America/ - [EMAIL PROTECTED]
-----------------------------------------------------------------------



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to