-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
FWIW, that's what I did in SpamAssassin -- using UNIVERSAL::can().
- --j.
Robert Spier writes:
> In my never-ending battle to allow for plugins to modify other plugin,
> I have a proposal to make that much easier.
>
> Instead of requiring plugins to register functions to hooks, lets
> define a set of subroutines that are the hook. If the subroutine
> exists, call it.
>
> (Here's the list of hooks..)
>
> config queue data data_post quit rcpt mail ehlo helo
> auth auth-plain auth-login auth-cram-md5
> connect reset_transaction unrecognized_command disconnect
> deny
>
> We could call the subroutines hook_${_} (i.e. hook_mail) or something.
>
> Since all the plugins are objects, we could then use UNIVERSAL::can or
> other symbol table fun. It's an increased startup cost as we have to
> iterate over all the possible hooks to see if the plugin "can" do it.
> As we seem to be heading towards more persistent systems, and less
> tcpserver stuff, the overhead disappears.
>
> This makes it much easier to subclass plugins. Which makes it much
> easier to extend plugins and have local customizations.
>
> In terms of backwards compatibility - we can maintain it by having the
> (current) register subroutine create the appropriate subroutine or
> alias.
>
> We lose the ability to have a plugin register multiple subroutines for
> a single hook. It'll have to do:
>
> sub hook_name {
> sub1(@_);
> sub2(@_);
> }
>
> but that's not really too bad.
>
> thoughts?
>
> -R
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Exmh CVS
iD8DBQFCr8uGMJF5cimLx9ARAqMeAJ48uPnb0/Upkdqr44B8e2Ta/DDnPACbB12l
QWcYykdimD6p4N3zoUusvrk=
=EAtZ
-----END PGP SIGNATURE-----