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

Re: [cgiapp] preview: ValidateRM as a plug-in


For those have not had a change to browse the source of Application::Pipeline, this is very close to how I am handling it there. My terminology is slightly different, and generally trusts plugins to import sane accessors/methods:

$app->loadPlugin( 'Service', @params );
$app->loadPlugins( qw( List Of Services Without Params ) );

$app->unloadPlugins( 'Foo' );

then the plugin authors have to write a load() methodand optionally an unload() method. The load method uses A::P's addServices() method to register functions or objects to the application that called it. More documentation here:

http://search.cpan.org/~howars/Application-Pipeline-0.1.1/lib/Application/Pipeline.pm#Writing_Plugins


Michael Peters wrote:

Stephen Howard wrote:

Although it is not really compatible with this approach, one of the nice things about many plugin systems is that while they all reside in a Foo::Plugin:: namespace, the mechanisms for importing the plugin usually lets you drop the Foo::Plugin:: prefix when referring to it and it will still do the Right Thing. Not really going anywhere with this, as it would require a different approach, but was looking at the character count of

 > use CGI::Application::Plugin::ValidateRM (qw/check_rm/);

versus something like

$app->load_plugin('ValidateRM', qw(check_rm));


That's an interesting idea... I wonder what others would think of allowing both? If we have a standard way of importing, naming, etc... for the plugins then this might act as sort of a pseudo way of enforcing it. It should be trivial to add that sub to C::A and the plugin's author would need to make sure that their plugin worked that way.

Just a thought.

--
Michael Peters
Developer
Plus Three, LP


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



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