}
sub test_render : Local {
- my ($self, $c) = @_;
+ my ($self, $c) = @_;
- $c->stash->{message} = $c->view('TT')->render($c, $c->req->param('template'), {param => $c->req->param('param')});
- $c->stash->{template} = 'test.tt';
+ my $out = $c->stash->{message} = $c->view('TT')->render($c, $c->req->param('template'), {param => $c->req->param('param') || ''});
+ if (UNIVERSAL::isa($out, 'Template::Exception')) {
+ $c->response->body($out);
+ $c->response->status(403);
+ } else {
+ $c->stash->{template} = 'test.tt';
+ }
}
sub test_msg : Local {
- my ($self, $c) = @_;
- my $tmpl = $c->req->param('msg');
-
- $c->stash->{message} = $c->view('TT')->render($c, \$tmpl);
- $c->stash->{template} = 'test.tt';
+ my ($self, $c) = @_;
+ my $tmpl = $c->req->param('msg');
+
+ $c->stash->{message} = $c->view('TT')->render($c, \$tmpl);
+ $c->stash->{template} = 'test.tt';
}
sub end : Private {