[Catalyst-dev] Catalyst plugin

Tomas Doran bobtfish at bobtfish.net
Tue Sep 30 09:38:29 BST 2008


On 30 Sep 2008, at 07:31, Octavian Rasnita wrote:
> I've created a Catalyst plugin and I want to upload it to CPAN.  
> Please tell me if it is well to use it as a plugin, or if the  
> suggested name is right.
> (It is my first perl module that I want to upload to CPAN.)

Nice one! :)

> So I've made a plugin that uses the module Mail::Builder to create  
> the message and Email::Send to send it.
> The suggested name would be Catalyst::Plugin::Mail.
>
> I think it could be a plugin, just as C::P::Email, because I think  
> the most easy would be to use it just as C::P::Email, but if you  
> have other suggestions, please tell me.

This *should not* be a Catalyst plugin.

That would specifically exclude anyone from having two email sending  
systems configured differently, and that's bad. Also putting stuff  
into Catalyst's global namespace when it isn't needed is baad..

This problem used to be most obvious in form builders - a load of  
these all too $c->form, meaning that you couldn't have two in the  
same application - sucktastic.

Please go and read the section in the manual about extending  
Catalyst: http://search.cpan.org/~zarquon/Catalyst-Manual-5.7013/lib/ 
Catalyst/Manual/ExtendingCatalyst.pod#Plugins

This should make it more clear why you don't want this to be a plugin..

I'd say that the actual templating parts of this should be a View,  
and if you need additional functionality in your controllers, it  
should be a controller base class..

As someone already pointed out, there is already a  
Catalyst::View::Email, maybe you should look to extending / enhancing  
that to do what you want?

Cheers
t0m





More information about the Catalyst-dev mailing list