[Catalyst-commits] r12775 - in
Catalyst-View-Mason/branches/test_fixes/t/lib/TestApp: . Controller
arcanez at dev.catalyst.perl.org
arcanez at dev.catalyst.perl.org
Fri Jan 29 16:58:08 GMT 2010
Author: arcanez
Date: 2010-01-29 16:58:08 +0000 (Fri, 29 Jan 2010)
New Revision: 12775
Added:
Catalyst-View-Mason/branches/test_fixes/t/lib/TestApp/Controller/
Catalyst-View-Mason/branches/test_fixes/t/lib/TestApp/Controller/Root.pm
Log:
move stuff out of TestApp.pm into TestApp/Controller/Root.pm to silence deprecation warnings
Added: Catalyst-View-Mason/branches/test_fixes/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-View-Mason/branches/test_fixes/t/lib/TestApp/Controller/Root.pm (rev 0)
+++ Catalyst-View-Mason/branches/test_fixes/t/lib/TestApp/Controller/Root.pm 2010-01-29 16:58:08 UTC (rev 12775)
@@ -0,0 +1,94 @@
+package TestApp::Controller::Root;
+
+use base qw(Catalyst::Controller);
+use Scalar::Util qw/blessed/;
+
+our $VERSION = '0.01';
+
+__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_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 = $c->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