[Catalyst-dev] Catalyst plugin

J. Shirley jshirley at gmail.com
Tue Sep 30 16:08:32 BST 2008


On Tue, Sep 30, 2008 at 7:23 AM, Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Tue, Sep 30, 2008 at 01:44:49PM +0300, Octavian Rasnita wrote:
>> Hi,
>>
>> Thank you all for recommending to create a view. I know about C::V::Email but I always prefered to use C::P::Email because it was more simple.
>
> C::V::Email is definitely a better approach; email sending really shouldn't
> need to be a plugin. Also note that using a plugin means you can only have
> one $c->email per app which means you can't re-use code as easily, whereas
> you can have several views and different controllers use different ones.
>
>> Anyway, probably partly I didn't like C::V::Email because I needed to create the email message manually if it contains attachments, images...
>>
>> I will try to create a view. I hope I will succeed.
>
> You should see about patching Catalyst::View::Email instead, I think.
>

Yes, definitely.  It's admirable to want to contribute to open source,
CPAN, etc.  It is less noble to think the only way to do this is to
step on the toes of others and reinvent wheels.  I've always been very
open to patches on C::V::Email, and since email is a very big part the
more eyes and hands on it the better.

If you just go off and write your own, you'll likely miss several key
things, or just outright fork the code and nobody wins.  If there is
something you distinct that you don't like about it (I understand some
people don't like the setup in stash, but that can be done away with
via simple methods that abstract that away) then discuss that and see
if we can come up with a solution.

Regarding attachments, it's been on the roadmap (and documented as
such in the pod) for a while but none of the contributors nor myself
have had a need for attachments so it simply hasn't gotten done.

> >From my memory C::V::Email::Template already handles creating the basic mail.
>
> Maybe by porting the mail sending code to either Mail::Builder or Email::Stuff
> you could achieve something where you can send attachments in the stash, and
> maybe have a syntax to get the mime addresses for images - something like
> adding $c->stash->{image_link} as a sub that resolves that so then in your
> template you can do [% image_link('foo.jpg') %} for
> $c->stash->{attachments}{foo.jpg} or something like that?
>

Yes.  Email::Stuff wasn't at a point where I wanted to use it for
C::V::Email, but that has changed.  I would much prefer to move to
Email::Stuff at the same time of the attachments.

As Bogdan said, we can use Email::MIME::CreateHTML if a single part is
html (most likely derived from a template).  I think this is somewhat
separate of an issue than simple attachments.  It may just be a worthy
patch to move to Email::MIME::CreateHTML in the case of
Email::Template and handle that outside of the main attachment loop.

This is also my concern with moving to something like Email::Stuff or
Mail::Builder (Email::Stuff being my preference) -- if there are edge
case behaviors (send HTML mail, with separate attachments, etc) I
don't know how the code will end up.

In any case, I'm happy to have as many contributors as possible.  I'll
setup branches and hand out commit bits.  I do not hand out comaint
for CPAN releases until I'm sure the work is of suitable quality to be
released without me or others blessing it.

-J



More information about the Catalyst-dev mailing list