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 email_app_config : Global('email_app_config') {
35 my ($self, $c, @args) = @_;
37 my $time = $c->req->params->{time} || time;
39 $c->stash->{email} = {
40 to => 'test-email@example.com',
41 from => 'no-reply@example.com',
42 subject => 'Email Test',
43 body => "Email Sent at: $time"
46 $c->forward('TestApp::View::Email::AppConfig');
48 if ( scalar( @{ $c->error } ) ) {
50 $c->res->body('Email Failed');
52 $c->res->body('Plain Email Ok');
56 sub template_email : Global('template_email') {
57 my ($self, $c, @args) = @_;
59 $c->stash->{time} = $c->req->params->{time} || time;
61 $c->stash->{email} = {
62 to => 'test-email@example.com',
63 from => 'no-reply@example.com',
64 subject => 'Just a test',
67 template => 'text_plain/test.tt',
68 content_type => 'text/plain',
72 template => 'text_html/test.tt',
73 content_type => 'text/html',
78 $c->forward('TestApp::View::Email::Template');
80 if ( scalar( @{ $c->error } ) ) {
82 $c->res->body('Template Email Failed');
84 $c->res->body('Template Email Ok');
88 sub template_email_app_config : Global('template_email_app_config') {
89 my ($self, $c, @args) = @_;
91 $c->stash->{time} = $c->req->params->{time} || time;
93 $c->stash->{template_email} = {
94 to => 'test-email@example.com',
95 from => 'no-reply@example.com',
96 subject => 'Just a test',
99 template => 'text_plain/test.tt',
100 content_type => 'text/plain',
104 template => 'text_html/test.tt',
105 content_type => 'text/html',
110 $c->forward('TestApp::View::Email::Template::AppConfig');
112 if ( scalar( @{ $c->error } ) ) {
113 $c->res->status(500);
114 $c->res->body('Template Email Failed');
116 $c->res->body('Template Email Ok');
120 sub mason_email : Global('mason_email') {
121 my ($self, $c, @args) = @_;
123 $c->stash->{time} = $c->req->params->{time} || time;
125 $c->stash->{email} = {
126 to => 'test-email@example.com',
127 from => 'no-reply@example.com',
128 subject => 'Just a test',
132 template => 'text_plain/test.m',
133 content_type => 'text/plain',
137 template => 'text_html/test.m',
138 content_type => 'text/html',
143 $c->forward('TestApp::View::Email::Template');
145 if ( scalar( @{ $c->error } ) ) {
146 $c->res->status(500);
147 $c->res->body('Mason Email Failed');
149 $c->res->body('Mason Email Ok');