1 package TestApp::Controller::Root;
2 use base 'Catalyst::Controller';
3 __PACKAGE__->config(namespace => '');
5 sub default : Private {
8 $c->response->redirect($c->uri_for('test'));
14 $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
15 $c->stash->{template} = $c->request->param('template');
18 sub test_includepath : Local {
20 $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
21 $c->stash->{template} = $c->request->param('template');
22 if ( $c->request->param('additionalpath') ){
23 my $additionalpath = Path::Class::dir($c->config->{root}, $c->request->param('additionalpath'));
24 $c->stash->{additional_template_paths} = ["$additionalpath"];
26 if ( $c->request->param('addpath') ){
27 my $additionalpath = Path::Class::dir($c->config->{root}, $c->request->param('addpath'));
28 my $view = 'TestApp::View::TT::' . ($c->request->param('view') || $c->config->{default_view});
30 push @{$view . '::include_path'}, "$additionalpath";
35 sub test_render : Local {
38 $c->stash->{message} = eval { $c->view('TT::Appconfig')->render($c, $c->req->param('template'), {param => $c->req->param('param') || ''}) };
40 $c->response->body($err);
41 $c->response->status(403);
43 $c->stash->{template} = 'test.tt';
48 sub test_msg : Local {
50 my $tmpl = $c->req->param('msg');
52 $c->stash->{message} = $c->view('TT::Appconfig')->render($c, \$tmpl);
53 $c->stash->{template} = 'test.tt';
56 sub test_alt_content_type : Local {
58 $c->stash( message => 'test_alt_content_type');
59 $c->forward('View::TT::AltContentType');
65 return 1 if $c->response->status =~ /^3\d\d$/;
66 return 1 if $c->response->body;
68 my $view = 'View::TT::' . ($c->request->param('view') || $c->config->{default_view});