From: J. Shirley Date: Thu, 22 Nov 2007 18:55:27 +0000 (+0000) Subject: Fixing the examples for forwarding to the view X-Git-Tag: v0.14~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9a222f27707be85c92d3c9a65364d83fa3b56c95;p=catagits%2FCatalyst-View-Email.git Fixing the examples for forwarding to the view --- diff --git a/lib/Catalyst/View/Email.pm b/lib/Catalyst/View/Email.pm index 987186e..ff74039 100644 --- a/lib/Catalyst/View/Email.pm +++ b/lib/Catalyst/View/Email.pm @@ -88,7 +88,7 @@ In your controller, simply forward to the view after populating the C subject => qq{Your Subject Here}, body => qq{Body Body Body} }; - $c->forward('View::Email'); + $c->forward( $c->view('Email' ) ); } Alternatively, you can use a more raw interface, and specify the headers as @@ -118,7 +118,7 @@ an array reference. If the email fails to send, the view will die (throw an exception). After your forward to the view, it is a good idea to check for errors: - $c->forward('View::Email'); + $c->forward( $c->view('Email' ) ); if ( scalar( @{ $c->error } ) ) { $c->error(0); # Reset the error condition if you need to $c->res->body('Oh noes!'); diff --git a/lib/Catalyst/View/Email/Template.pm b/lib/Catalyst/View/Email/Template.pm index 0a5548e..c7adcda 100644 --- a/lib/Catalyst/View/Email/Template.pm +++ b/lib/Catalyst/View/Email/Template.pm @@ -78,7 +78,7 @@ Sending email is just setting up your defaults, the stash key and forwarding to subject => 'I am a Catalyst generated email', template => 'test.tt', }; - $c->forward('View::Email::Template'); + $c->forward( $c->view('Email::Template' ) ); Alternatively if you want more control over your templates you can use the following idiom to override the defaults: