[Catalyst-commits] r11690 - in Catalyst-View-TT/trunk: . t/lib
t/lib/TestApp t/lib/TestApp/Controller
theory at dev.catalyst.perl.org
theory at dev.catalyst.perl.org
Thu Oct 29 19:25:04 GMT 2009
Author: theory
Date: 2009-10-29 19:25:03 +0000 (Thu, 29 Oct 2009)
New Revision: 11690
Added:
Catalyst-View-TT/trunk/t/lib/TestApp/Controller/
Catalyst-View-TT/trunk/t/lib/TestApp/Controller/Root.pm
Modified:
Catalyst-View-TT/trunk/Changes
Catalyst-View-TT/trunk/t/lib/TestApp.pm
Log:
Move the test actions to their own controller file to silence warning about
actions in the app class being deprecated.
Modified: Catalyst-View-TT/trunk/Changes
===================================================================
--- Catalyst-View-TT/trunk/Changes 2009-10-29 19:04:48 UTC (rev 11689)
+++ Catalyst-View-TT/trunk/Changes 2009-10-29 19:25:03 UTC (rev 11690)
@@ -1,5 +1,9 @@
Revision history for Perl extension Catalyst::View::TT.
+0.31
+ - Moved the test actions to their own controller file to silence
+ warning about actions in the app class being deprecated.
+
0.30 2009-09-12 23:47:00
- Doc fixes:
+ Expand ::V:: to ::View:: (RT #45792)
Added: Catalyst-View-TT/trunk/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-View-TT/trunk/t/lib/TestApp/Controller/Root.pm (rev 0)
+++ Catalyst-View-TT/trunk/t/lib/TestApp/Controller/Root.pm 2009-10-29 19:25:03 UTC (rev 11690)
@@ -0,0 +1,65 @@
+package TestApp::Controller::Root;
+use base 'Catalyst::Controller';
+__PACKAGE__->config(namespace => '');
+
+sub default : Private {
+ my ($self, $c) = @_;
+
+ $c->response->redirect($c->uri_for('test'));
+}
+
+sub test : Local {
+ my ($self, $c) = @_;
+
+ $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
+}
+
+sub test_includepath : Local {
+ my ($self, $c) = @_;
+ $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
+ $c->stash->{template} = $c->request->param('template');
+ if ( $c->request->param('additionalpath') ){
+ my $additionalpath = Path::Class::dir($c->config->{root}, $c->request->param('additionalpath'));
+ $c->stash->{additional_template_paths} = ["$additionalpath"];
+ }
+ if ( $c->request->param('addpath') ){
+ my $additionalpath = Path::Class::dir($c->config->{root}, $c->request->param('addpath'));
+ my $view = 'TestApp::View::TT::' . ($c->request->param('view') || $c->config->{default_view});
+ no strict "refs";
+ push @{$view . '::include_path'}, "$additionalpath";
+ use strict;
+ }
+}
+
+sub test_render : Local {
+ my ($self, $c) = @_;
+
+ my $out = $c->stash->{message} = $c->view('TT::Appconfig')->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::AppConfig')->render($c, \$tmpl);
+ $c->stash->{template} = 'test.tt';
+}
+
+sub end : Private {
+ my ($self, $c) = @_;
+
+ return 1 if $c->response->status =~ /^3\d\d$/;
+ return 1 if $c->response->body;
+
+ my $view = 'View::TT::' . ($c->request->param('view') || $c->config->{default_view});
+ $c->forward($view);
+}
+
+1;
Modified: Catalyst-View-TT/trunk/t/lib/TestApp.pm
===================================================================
--- Catalyst-View-TT/trunk/t/lib/TestApp.pm 2009-10-29 19:04:48 UTC (rev 11689)
+++ Catalyst-View-TT/trunk/t/lib/TestApp.pm 2009-10-29 19:25:03 UTC (rev 11690)
@@ -21,64 +21,3 @@
__PACKAGE__->setup;
-sub default : Private {
- my ($self, $c) = @_;
-
- $c->response->redirect($c->uri_for('test'));
-}
-
-sub test : Local {
- my ($self, $c) = @_;
-
- $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
-}
-
-sub test_includepath : Local {
- my ($self, $c) = @_;
- $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
- $c->stash->{template} = $c->request->param('template');
- if ( $c->request->param('additionalpath') ){
- my $additionalpath = Path::Class::dir($c->config->{root}, $c->request->param('additionalpath'));
- $c->stash->{additional_template_paths} = ["$additionalpath"];
- }
- if ( $c->request->param('addpath') ){
- my $additionalpath = Path::Class::dir($c->config->{root}, $c->request->param('addpath'));
- my $view = 'TestApp::View::TT::' . ($c->request->param('view') || $c->config->{default_view});
- no strict "refs";
- push @{$view . '::include_path'}, "$additionalpath";
- use strict;
- }
-}
-
-sub test_render : Local {
- my ($self, $c) = @_;
-
- my $out = $c->stash->{message} = $c->view('TT::Appconfig')->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::AppConfig')->render($c, \$tmpl);
- $c->stash->{template} = 'test.tt';
-}
-
-sub end : Private {
- my ($self, $c) = @_;
-
- return 1 if $c->response->status =~ /^3\d\d$/;
- return 1 if $c->response->body;
-
- my $view = 'View::TT::' . ($c->request->param('view') || $c->config->{default_view});
- $c->forward($view);
-}
-
-1;
More information about the Catalyst-commits
mailing list