[Catalyst-dev] Catalyst plugin

J. Shirley jshirley at gmail.com
Sun Oct 5 18:18:44 BST 2008


On Sun, Oct 5, 2008 at 9:32 AM, Octavian Rasnita <orasnita at gmail.com> wrote:
> From: "J. Shirley" <jshirley at gmail.com>>
>>
>> Honestly I don't even see why you would release a
>> Catalyst::Model::Email, instead just bundle a code snippet that uses
>> Catalyst::Model::Adaptor.
>
> I think that a beginner would find easier to install just a module, run a
> command for creating a model, then use a single method to send a UTF-8
> encoded email, with attachments and images shown in the HTML part of the
> message than using C::V::Email and create each part of the message, do the
> encoding of headers and add attachments (if possible).
>
> I don't understand why you think that my module won't be helpful for many
> beginners and even for the advanced users, because it is easier to use it
> for sending email, with one or more attachments, taken from static files or
> from templates of different types, template files or from variables...
>

Because you don't understand what I'm talking about.  That isn't what
I said at all.

>> Don't pollute CPAN with things like Catalyst::Model::YouTube ...
>> stupid modules that jrockway fortunately deprecated.
>
> The model I wanted to do can do more than C::V::Email and easier, so I don't
> think it pollutes the CPAN.
>
> If there is another simpler way to send UTF-8 encoded email messages with a
> text and an html part, with inline images and attachments from files and
> templates, then you are right and I would probably like to use that module,
> so please tell me about it.
>

No, you are just missing the point about my comments about polluting
CPAN.  I'm telling you that putting
Catalyst::Model::{YourGlueToYourMailModule} is dumb. The reason is
that your model code would (or, rather, should) be nothing more than:

package MyApp::Model::Email;

use base 'Catalyst::Model::Adaptor';

__PACKAGE__->config( class => 'Mail::Builder::Simple::TT' ); # Or
whatever you end up naming your mail module

1;

__END__

If your model code contains significantly more than that, you're
likely doing it wrong.  Catalyst is glue.

If you really think that the glue is worth putting on CPAN, you'll
likely find nearly everybody disagreeing.  You can always include a
Catalyst::Helper package that can create the model class via
"myapp_create.pl model Mail Mail::Builder", and that will just
generate the above code.

Since you seem to misunderstand the workflow, here's how I see it and
you can correct me if I'm wrong:
You wanted to decouple your mail delivery mechanism from Catalyst and
essentially wrap Mail::Builder.  Hence, the model space so you can
easily use it outside of Catalyst.  If you put everything in the
Catalyst::Model namespace, you're doing it wrong.  Therefor, it would
be simply Mail::Builder::Simple::TT or whatever.  The model class that
Catalyst would use would simply return an instantiated object,
therefor MyApp::Model::Email would be nothing more than
Catalyst::Model::Adaptor-based code.



More information about the Catalyst-dev mailing list