Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of markjugg (792)

Saturday August 06, 2005
12:41 PM

Let's extend Class::Trigger with CGI::App's plugin design

[ #26143 ]
As I worked on a new plugin system for HTML::Template, I recycled code from CGI::Application's new plugin system.

As I reflected on this, CGI::Application has developed a nice plugin system which is easily re-usable on it's own.

It is most similar to Class::Trigger, but I think the CGI::App solution is more advanced for these reasons:

  • We look up the inheritance tree for more callbacks to execute
  • We allow arguments to be passed into the callbacks, customizing how each callback can work, and creating clearer, more explicit syntax than passing through the object.
  • We have a specific callback ordering, and we expect to soon solve the problem of making this ordering to be sufficiently flexible to address most plugin needs.
  • Class::Trigger requires your object be implemented as blessed hashref (Gasp!). We could solve this in our implementation by adding a method for 'installed_callbacks()', which could be trivially overridden if the callbacks needed to be stored in the object a different way.

So I would like to move CGI::App's plugin system into it's own module, which wouldn't change anything from a user's perspective, except perhaps where the related documentation is located.

I could see what we have possibly being merged into a future enhanced version of Class::Trigger, which CGI::App would then have it's own plugin for, to keep compatibility with the names we've already established.

Collaborators welcome! Let's keep discussing it on the CGI::Application mailing list and #cgiapp on irc.perl.org.

Mark

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.