[Catalyst-commits] r14555 - in Catalyst-View-Mason/trunk/t/lib: . TestApp TestApp/Controller
jnapiorkowski at dev.catalyst.perl.org
jnapiorkowski at dev.catalyst.perl.org
Mon Dec 29 21:29:52 GMT 2014
Author: jnapiorkowski
Date: 2014-12-29 21:29:52 +0000 (Mon, 29 Dec 2014)
New Revision: 14555
Added:
Catalyst-View-Mason/trunk/t/lib/TestApp/Controller/
Catalyst-View-Mason/trunk/t/lib/TestApp/Controller/Root.pm
Modified:
Catalyst-View-Mason/trunk/t/lib/TestApp.pm
Log:
fixed for modern catalyst
Copied: Catalyst-View-Mason/trunk/t/lib/TestApp/Controller/Root.pm (from rev 13482, Catalyst-View-Mason/trunk/t/lib/TestApp.pm)
===================================================================
--- Catalyst-View-Mason/trunk/t/lib/TestApp/Controller/Root.pm (rev 0)
+++ Catalyst-View-Mason/trunk/t/lib/TestApp/Controller/Root.pm 2014-12-29 21:29:52 UTC (rev 14555)
@@ -0,0 +1,88 @@
+package TestApp::Controller::Root;
+
+use strict;
+use warnings;
+use base qw/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 = $self->view->render(
+ $c, $c->request->param('template'),
+ { param => $c->req->param('param') || '' },
+ );
+
+ $c->response->body($out);
+
+ if (blessed($out) && $out->isa('HTML::Mason::Exception')) {
+ $c->response->status(403);
+ }
+}
+
+sub match : Local Args(1) {
+ my ($self, $c) = @_;
+
+ $c->stash->{message} = $c->request->args->[0];
+}
+
+sub action_match : Local Args(1) {
+ my ($self, $c) = @_;
+
+ $c->stash->{message} = $c->request->args->[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;
Modified: Catalyst-View-Mason/trunk/t/lib/TestApp.pm
===================================================================
--- Catalyst-View-Mason/trunk/t/lib/TestApp.pm 2014-12-29 16:13:06 UTC (rev 14554)
+++ Catalyst-View-Mason/trunk/t/lib/TestApp.pm 2014-12-29 21:29:52 UTC (rev 14555)
@@ -34,82 +34,5 @@
__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 = $self->view->render(
- $c, $c->request->param('template'),
- { param => $c->req->param('param') || '' },
- );
-
- $c->response->body($out);
-
- if (blessed($out) && $out->isa('HTML::Mason::Exception')) {
- $c->response->status(403);
- }
-}
-
-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