[Catalyst-dev] Catalyst plugin

J. Shirley jshirley at gmail.com
Sun Oct 5 16:37:05 BST 2008


On Sun, Oct 5, 2008 at 4:23 AM, Octavian Rasnita <orasnita at gmail.com> wrote:
> From: "Matt S Trout" <dbix-class at trout.me.uk>
>>>
>>> I thought that if the mail message is created with Mail::Builder, the
>>> name Catalyst::View::Mail could be a good name for the module.
>>
>> No no no no no no no.
>>
>> Having a C::V::Email -and- a C::V::Mail will confuse the shit out of
>> newbies
>> to no gain. Please, please don't do that.
>
> Ok, I won't do that. Using some suggestions from the list and because I have
> seen that the interface for accessing a model is nicer, I think I will made
> it a model.
>
> So it will be named C::M::Email or C::M::Mail.
> This won't confuse the beginners, not only because C::V::Email is a view and
> this would be a model, but because the interfaces will be totally different
> (because one is a view and the other a model).
>
> In this case, sending an email would be an action just like when saving data
> into a database and I hope I could make the interface to look like:
>
> $c->model("Email")->send(from => $from, to => $to, subject => $subject,
> htmltext => $html);
>
> Of course, if the old users will have these parameters in
> $c->stash->{email}, I hope I will make C::M::Email to be able to be used
> also as:
>
> $c->model("Email")->send(@{$c->stash->{email}});
>
> instead of
>
> $c->forward($c->view("Email"));
>
> Actually, I already started to make C::M::Email and it also works, but
> unfortunately I can get the parameters only from the MyApp.pm configuration
> and from the controller when doing $c->model("Email")->send(...).
>
> But I don't know how to get (in C::M::Email) the parameters set in
> MyApp::Model::Email using:
>
> __PACKAGE__->config(
> mailer_args => ['SMTP', Host => 'smtp.host.com'],
> from => ['me at host.com', 'My Name'],
> );
>
> They are not taken into consideration...
>
> I have tried with:
>
> sub new {
> my $self = shift;
> my ( $c ) = @_;
> $self = $self->NEXT::new( @_ );
> #For the moment I don't know why I should use the line above...
>
> my $settings = $c->config->{'Model::Email'};
> }
>
> Thank you.
>
> Octavian
>
>

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.

Don't pollute CPAN with things like Catalyst::Model::YouTube ...
stupid modules that jrockway fortunately deprecated.

-J



More information about the Catalyst-dev mailing list