[Catalyst-commits] r11726 - in
Catalyst-View-Mason/branches/render_die: . t/lib
t/lib/TestApp t/lib/TestApp/Controller
theory at dev.catalyst.perl.org
theory at dev.catalyst.perl.org
Tue Nov 3 01:12:36 GMT 2009
Author: theory
Date: 2009-11-03 01:12:35 +0000 (Tue, 03 Nov 2009)
New Revision: 11726
Added:
Catalyst-View-Mason/branches/render_die/t/lib/TestApp/Controller/
Catalyst-View-Mason/branches/render_die/t/lib/TestApp/Controller/Root.pm
Modified:
Catalyst-View-Mason/branches/render_die/Changes
Catalyst-View-Mason/branches/render_die/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-Mason/branches/render_die/Changes
===================================================================
--- Catalyst-View-Mason/branches/render_die/Changes 2009-11-03 01:08:54 UTC (rev 11725)
+++ Catalyst-View-Mason/branches/render_die/Changes 2009-11-03 01:12:35 UTC (rev 11726)
@@ -5,6 +5,8 @@
the exception object.
- Changed name of the undocumented attribute in which the Mason
interpreter is stored from "template" to "interp".
+ - Moved the test actions to their own controller file to silence
+ warning about actions in the app class being deprecated.
0.18 Sat, 22 Aug 2009 21:17:52 +0200
- Make it work with Catalyst::Runtime 5.80010.
Added: Catalyst-View-Mason/branches/render_die/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-View-Mason/branches/render_die/t/lib/TestApp/Controller/Root.pm (rev 0)
+++ Catalyst-View-Mason/branches/render_die/t/lib/TestApp/Controller/Root.pm 2009-11-03 01:12:35 UTC (rev 11726)
@@ -0,0 +1,87 @@
+package TestApp::Controller::Root;
+use base 'Catalyst::Controller';
+__PACKAGE__->config(namespace => '');
+
+
+sub test : Local {
+ my ($self, $c) = @_;
+
+ $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
+}
+
+sub test_set_template : Local {
+ my ($self, $c) = @_;
+
+ $c->forward('test');
+ $c->stash->{template} = 'test';
+}
+
+sub test_content_type : Local {
+ my ($self, $c) = @_;
+
+ $c->forward('test');
+
+ $c->stash->{template} = '/test';
+
+ $c->response->content_type('text/html; charset=iso8859-1')
+}
+
+sub exception : Local {
+ my ($self, $c) = @_;
+
+ $c->log->abort(1); #silence errors
+}
+
+sub render : Local {
+ my ($self, $c) = @_;
+
+ my $out = eval {
+ $c->view->render(
+ $c, $c->request->param('template'),
+ { param => $c->req->param('param') || '' },
+ )
+ };
+
+ if (my $err = $@) {
+ $c->response->body($err);
+ $c->response->status(403);
+ }
+ else {
+ $c->response->body($out);
+ }
+}
+
+sub match : Regex('^match/(\w+)') {
+ my ($self, $c) = @_;
+
+ $c->stash->{message} = $c->request->captures->[0];
+}
+
+sub action_match : Regex('^action_match/(\w+)') {
+ my ($self, $c) = @_;
+
+ $c->stash->{message} = $c->request->captures->[0];
+}
+
+sub globals : Local {
+}
+
+sub additional_globals : Local {
+}
+
+sub comp_path : Local {
+ my ($self, $c) = @_;
+
+ $c->stash->{param} = 'bar';
+}
+
+sub end : Private {
+ my ($self, $c) = @_;
+
+ return 1 if $c->response->status =~ /^3\d\d$/;
+ return 1 if $c->response->body;
+
+ my ($requested_view) = $c->request->param('view');
+ $c->forward($c->view( $requested_view ? "Mason::$requested_view" : () ));
+}
+
Modified: Catalyst-View-Mason/branches/render_die/t/lib/TestApp.pm
===================================================================
--- Catalyst-View-Mason/branches/render_die/t/lib/TestApp.pm 2009-11-03 01:08:54 UTC (rev 11725)
+++ Catalyst-View-Mason/branches/render_die/t/lib/TestApp.pm 2009-11-03 01:12:35 UTC (rev 11726)
@@ -34,86 +34,4 @@
__PACKAGE__->setup;
-sub test : Local {
- my ($self, $c) = @_;
-
- $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
-}
-
-sub test_set_template : Local {
- my ($self, $c) = @_;
-
- $c->forward('test');
- $c->stash->{template} = 'test';
-}
-
-sub test_content_type : Local {
- my ($self, $c) = @_;
-
- $c->forward('test');
-
- $c->stash->{template} = '/test';
-
- $c->response->content_type('text/html; charset=iso8859-1')
-}
-
-sub exception : Local {
- my ($self, $c) = @_;
-
- $c->log->abort(1); #silence errors
-}
-
-sub render : Local {
- my ($self, $c) = @_;
-
- my $out = eval {
- $self->view->render(
- $c, $c->request->param('template'),
- { param => $c->req->param('param') || '' },
- )
- };
-
- if (my $err = $@) {
- $c->response->body($err);
- $c->response->status(403);
- }
- else {
- $c->response->body($out);
- }
-}
-
-sub match : Regex('^match/(\w+)') {
- my ($self, $c) = @_;
-
- $c->stash->{message} = $c->request->captures->[0];
-}
-
-sub action_match : Regex('^action_match/(\w+)') {
- my ($self, $c) = @_;
-
- $c->stash->{message} = $c->request->captures->[0];
-}
-
-sub globals : Local {
-}
-
-sub additional_globals : Local {
-}
-
-sub comp_path : Local {
- my ($self, $c) = @_;
-
- $c->stash->{param} = 'bar';
-}
-
-sub end : Private {
- my ($self, $c) = @_;
-
- return 1 if $c->response->status =~ /^3\d\d$/;
- return 1 if $c->response->body;
-
- my ($requested_view) = $c->request->param('view');
- $c->forward($c->view( $requested_view ? "Mason::$requested_view" : () ));
-}
-
1;
More information about the Catalyst-commits
mailing list