[Catalyst-commits] r6523 - in trunk/Catalyst-View-Email: .
lib/Catalyst/View lib/Catalyst/View/Email t/lib
t/lib/TestApp/Controller
jshirley at dev.catalyst.perl.org
jshirley at dev.catalyst.perl.org
Thu Jul 12 16:33:42 GMT 2007
Author: jshirley
Date: 2007-07-12 16:33:41 +0100 (Thu, 12 Jul 2007)
New Revision: 6523
Modified:
trunk/Catalyst-View-Email/MANIFEST
trunk/Catalyst-View-Email/lib/Catalyst/View/Email.pm
trunk/Catalyst-View-Email/lib/Catalyst/View/Email/Template.pm
trunk/Catalyst-View-Email/t/lib/TestApp.pm
trunk/Catalyst-View-Email/t/lib/TestApp/Controller/Root.pm
Log:
0.02 patch thanks to dwc.
Modified: trunk/Catalyst-View-Email/MANIFEST
===================================================================
--- trunk/Catalyst-View-Email/MANIFEST 2007-07-12 12:51:09 UTC (rev 6522)
+++ trunk/Catalyst-View-Email/MANIFEST 2007-07-12 15:33:41 UTC (rev 6523)
@@ -1,3 +1,14 @@
+inc/Module/AutoInstall.pm
+inc/Module/Install.pm
+inc/Module/Install/AutoInstall.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Include.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
lib/Catalyst/Helper/View/Email.pm
lib/Catalyst/Helper/View/Email/Template.pm
lib/Catalyst/View/Email.pm
@@ -5,3 +16,14 @@
Makefile.PL
MANIFEST This list of files
META.yml
+t/01use.t
+t/02pod.t
+t/04basic.t
+t/05template.t
+t/lib/TestApp.pm
+t/lib/TestApp/Controller/Root.pm
+t/lib/TestApp/View/Email.pm
+t/lib/TestApp/View/Email/Template.pm
+t/lib/TestApp/View/TT.pm
+t/root/text_html/test.tt
+t/root/text_plain/test.tt
Modified: trunk/Catalyst-View-Email/lib/Catalyst/View/Email/Template.pm
===================================================================
--- trunk/Catalyst-View-Email/lib/Catalyst/View/Email/Template.pm 2007-07-12 12:51:09 UTC (rev 6522)
+++ trunk/Catalyst-View-Email/lib/Catalyst/View/Email/Template.pm 2007-07-12 15:33:41 UTC (rev 6523)
@@ -10,7 +10,7 @@
use base qw|Catalyst::View::Email|;
-our $VERSION = '0.01';
+our $VERSION = '0.02';
=head1 NAME
@@ -149,6 +149,7 @@
There needs to be a method to support attachments. What I am thinking is
something along these lines:
+
attachments => [
# Set the body to a file handle object, specify content_type and
# the file name. (name is what it is sent at, not the file)
Modified: trunk/Catalyst-View-Email/lib/Catalyst/View/Email.pm
===================================================================
--- trunk/Catalyst-View-Email/lib/Catalyst/View/Email.pm 2007-07-12 12:51:09 UTC (rev 6522)
+++ trunk/Catalyst-View-Email/lib/Catalyst/View/Email.pm 2007-07-12 15:33:41 UTC (rev 6523)
@@ -11,7 +11,7 @@
use base qw|Catalyst::View|;
-our $VERSION = '0.01';
+our $VERSION = '0.02';
__PACKAGE__->mk_accessors('mailer');
@@ -27,6 +27,7 @@
=head1 CONFIGURATION
In your app configuration (example in L<YAML>):
+
View::Email:
stash_key: email
content_type: text/plain
@@ -96,21 +97,23 @@
=head1 OTHER MAILERS
-Now, it's no fun to just send out email using plain strings. We also have
-L<Catalyst::View::Email::TT> for use. You can also toggle this as being used
-by setting up your configuration to look like this:
+Now, it's no fun to just send out email using plain strings. We also
+have L<Catalyst::View::Email::Template> for use. You can also toggle
+this as being used by setting up your configuration to look like this:
View::Email:
- default: TT
+ default_view: TT
-Then, Catalyst::View::Email will forward to View::Email::TT by default.
+Then, Catalyst::View::Email will forward to your View::TT by default.
=cut
sub new {
- my ( $class ) = shift;
- my $self = $class->next::method(@_);
+ my $self = shift->next::method(@_);
+ my ( $c, $arguments ) = @_;
+ $self->config($arguments);
+
my $mailer = Email::Send->new;
if ( my $method = $self->config->{sender}->{method} ) {
@@ -193,6 +196,12 @@
J. Shirley <jshirley at gmail.com>
+=head1 CONTRIBUTORS
+
+(Thanks!)
+
+Daniel Westermann-Clark
+
=head1 LICENSE
This library is free software, you can redistribute it and/or modify it under
Modified: trunk/Catalyst-View-Email/t/lib/TestApp/Controller/Root.pm
===================================================================
--- trunk/Catalyst-View-Email/t/lib/TestApp/Controller/Root.pm 2007-07-12 12:51:09 UTC (rev 6522)
+++ trunk/Catalyst-View-Email/t/lib/TestApp/Controller/Root.pm 2007-07-12 15:33:41 UTC (rev 6523)
@@ -31,6 +31,28 @@
}
}
+sub email_app_config : Global('email_app_config') {
+ my ($self, $c, @args) = @_;
+
+ my $time = $c->req->params->{time} || time;
+
+ $c->stash->{email} = {
+ to => 'test-email at example.com',
+ from => 'no-reply at example.com',
+ subject => 'Email Test',
+ body => "Email Sent at: $time"
+ };
+
+ $c->forward('TestApp::View::Email::AppConfig');
+
+ if ( scalar( @{ $c->error } ) ) {
+ $c->res->status(500);
+ $c->res->body('Email Failed');
+ } else {
+ $c->res->body('Plain Email Ok');
+ }
+}
+
sub template_email : Global('template_email') {
my ($self, $c, @args) = @_;
Modified: trunk/Catalyst-View-Email/t/lib/TestApp.pm
===================================================================
--- trunk/Catalyst-View-Email/t/lib/TestApp.pm 2007-07-12 12:51:09 UTC (rev 6522)
+++ trunk/Catalyst-View-Email/t/lib/TestApp.pm 2007-07-12 15:33:41 UTC (rev 6523)
@@ -6,7 +6,12 @@
TestApp->config(
root => "$FindBin::Bin/root",
- default_view => 'TT'
+ default_view => 'TT',
+ 'View::Email::AppConfig' => {
+ sender => {
+ method => 'Test',
+ },
+ },
);
TestApp->setup;
More information about the Catalyst-commits
mailing list