[Catalyst-dev] Catalyst plugin
    Octavian Rasnita 
    orasnita at gmail.com
       
    Sun Oct  5 12:23:26 BST 2008
    
    
  
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
    
    
More information about the Catalyst-dev
mailing list