6 use Catalyst; # qw/-Debug/;
13 default_message => 'hi',
14 default_view => 'Pkgconfig',
15 'View::TT::Appconfig' => {
18 TEMPLATE_EXTENSION => '.tt',
24 sub default : Private {
27 $c->response->redirect($c->uri_for('test'));
33 $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
36 sub test_includepath : Local {
38 $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
39 $c->stash->{template} = $c->request->param('template');
40 if ( $c->request->param('additionalpath') ){
41 my $additionalpath = Path::Class::dir($c->config->{root}, $c->request->param('additionalpath'));
42 $c->stash->{additional_template_paths} = ["$additionalpath"];
44 if ( $c->request->param('addpath') ){
45 my $additionalpath = Path::Class::dir($c->config->{root}, $c->request->param('addpath'));
46 my $view = 'TestApp::View::TT::' . ($c->request->param('view') || $c->config->{default_view});
48 push @{$view . '::include_path'}, "$additionalpath";
53 sub test_render : Local {
56 my $out = $c->stash->{message} = $c->view('TT::Appconfig')->render($c, $c->req->param('template'), {param => $c->req->param('param') || ''});
57 if (UNIVERSAL::isa($out, 'Template::Exception')) {
58 $c->response->body($out);
59 $c->response->status(403);
61 $c->stash->{template} = 'test.tt';
66 sub test_msg : Local {
68 my $tmpl = $c->req->param('msg');
70 $c->stash->{message} = $c->view('TT::AppConfig')->render($c, \$tmpl);
71 $c->stash->{template} = 'test.tt';
77 return 1 if $c->response->status =~ /^3\d\d$/;
78 return 1 if $c->response->body;
80 my $view = 'View::TT::' . ($c->request->param('view') || $c->config->{default_view});