1 package # Hide from PAUSE
2 TestApp::Controller::Root;
4 use base qw(Catalyst::Controller);
6 sub default : Private {
9 $c->res->body(qq{Nothing Here});
12 sub email : Global('email') {
13 my ($self, $c, @args) = @_;
15 my $time = $c->req->params->{time} || time;
17 $c->stash->{email} = {
18 to => 'test-email@example.com',
19 from => 'no-reply@example.com',
20 subject => 'Email Test',
21 body => "Email Sent at: $time"
24 $c->forward('TestApp::View::Email');
26 if ( scalar( @{ $c->error } ) ) {
28 $c->res->body('Email Failed');
30 $c->res->body('Plain Email Ok');
34 sub template_email : Global('template_email') {
35 my ($self, $c, @args) = @_;
37 $c->stash->{time} = $c->req->params->{time} || time;
39 $c->stash->{email} = {
40 to => 'test-email@example.com',
41 from => 'no-reply@example.com',
42 subject => 'Just a test',
43 content_type => 'multipart/alternative',
45 qw{text_plain/test.tt},
50 $c->forward('TestApp::View::Email::Template');
52 if ( scalar( @{ $c->error } ) ) {
54 $c->res->body('Template Email Failed');
56 $c->res->body('Template Email Ok');