Cees Hek wrote:
Hi All,

It's been fairly quiet on the development side of things with CGI::Application, so I thought I would try to stir things up again ;)

Good idea.

A little while ago, I noticed some talk on the Class::DBI list about a plugin architecture for Class::DBI. Someone actually followed through on the discussion and built Class::DBI::Plugin, which according to the docs is an "Abstract base class for Class::DBI plugins".

I really love the plugin based model that so many other modules (Template Toolkit, Class::DBI now, etc). It really simplifies development yet it doesn't the flexibility that we all enjoy. Don't like the plugin, don't use it.


Plus, by getting a lot of already built plugins I think C::A will attract more users and make it easier for some to start.


The implementation is very simple, and I think is worthwhile looking at for CGI::Application. So I took about an hour out of my usually busy TV watching schedule and threw together CGI::Application::Plugin.

It simplifies and standardizes the way a plugin can be built for CGI::Application, and it works completely outside of the CGI::Application codebase (ie no patches necesary). It avoids the annoyances of building a big inheritance tree for the plugins you want to use by copying a given set of methods into the callers namespace. No exporting or name space munging needs to be done by the plugin modules, as this is done automatically.

As an example of how it works, I have put up new versions of the CGI::Application::Session and CGI::Application::TT modules on my website (http://cees.crtconsulting.ca/perl/modules/), as well as a tarball containing the actual CGI::Application::Plugin module. I won't upload this stuff to CPAN unless there is some positive discussion about this, hence it is just on my website for now. If people don't like it, I can just scrap it without polluting the CPAN, no harm done.

I have attached the pm file for those that don't want to pull down the tarball. I've also inlined it, since I have had trouble sending attachments to this list in the past.

Just a couple of questions/thoughts...

The CGIAppPluginMethod attribute seems to be a bit long. Is it possible to shorten it to say 'plugin_method' or something like that. I seriously doubt that anyone who uses a base class called 'CGI::Application::Plugin' won't know that the method they are marking as a 'plugin_method' is for a CGI::Application.

This still doesn't address the issue that we was discussed many moons ago about the ability to register multiple callbacks for the init, prerun, postrun, etc, stages. We will need to address this before we move much further (although this seems to be an issue with C::A and not with your plugin structure)

I like it so far. Simple yet does what it needs to do.
Thanks for putting your TV viewing on hold. :)

Michael Peters
Developer
Plus Three

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