[Catalyst-commits] r11693 - in Catalyst-View-TD/trunk/t/lib: . TestApp TestApp/Controller

theory at dev.catalyst.perl.org theory at dev.catalyst.perl.org
Thu Oct 29 19:36:05 GMT 2009


Author: theory
Date: 2009-10-29 19:36:05 +0000 (Thu, 29 Oct 2009)
New Revision: 11693

Added:
   Catalyst-View-TD/trunk/t/lib/TestApp/Controller/
   Catalyst-View-TD/trunk/t/lib/TestApp/Controller/Root.pm
Modified:
   Catalyst-View-TD/trunk/t/lib/TestApp.pm
Log:
Move controller actions to their own file, to get rid of deprecation warnings.


Added: Catalyst-View-TD/trunk/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-View-TD/trunk/t/lib/TestApp/Controller/Root.pm	                        (rev 0)
+++ Catalyst-View-TD/trunk/t/lib/TestApp/Controller/Root.pm	2009-10-29 19:36:05 UTC (rev 11693)
@@ -0,0 +1,84 @@
+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_prepend_dispatchto : Local {
+    my ($self, $c) = @_;
+    $c->stash->{message}  = $c->request->param('message') || $c->config->{default_message};
+    $c->stash->{template} = $c->request->param('template');
+    if ( my $class = $c->request->param('additionalclass') ){
+        $c->stash->{prepend_template_classes} = [$class];
+    }
+    if ( my $class = $c->request->param('addclass') ){
+        my $view = $c->view($c->request->param('view') || $c->config->{default_view});
+        push @{ $view->dispatch_to}, $class;
+    }
+    if ( my $class = $c->request->param('setclass') ){
+        my $view = $c->view($c->request->param('view') || $c->config->{default_view});
+        $view->dispatch_to([$class]);
+    }
+}
+
+sub test_append_dispatchto : Local {
+    my ($self, $c) = @_;
+    $c->stash->{message}  = $c->request->param('message') || $c->config->{default_message};
+    $c->stash->{template} = $c->request->param('template');
+    if ( my $class = $c->request->param('additionalclass') ){
+        $c->stash->{append_template_classes} = [$class];
+    }
+    if ( my $class = $c->request->param('addclass') ){
+        my $view = $c->view($c->request->param('view') || $c->config->{default_view});
+        push @{ $view->dispatch_to}, $class;
+    }
+    if ( my $class = $c->request->param('setclass') ){
+        my $view = $c->view($c->request->param('view') || $c->config->{default_view});
+        $view->dispatch_to([$class]);
+    }
+}
+
+sub test_render : Local {
+    my ($self, $c) = @_;
+
+    my $out = $c->stash->{message} = $c->view('Appconfig')->render(
+        $c, $c->req->param('template'), {param => $c->req->param('param') || ''}
+    );
+    if (ref $out) {
+        $c->response->body($$out);
+        $c->response->status(403);
+    } else {
+        $c->stash->{template} = 'test';
+    }
+
+}
+
+sub test_msg : Local {
+    my ($self, $c) = @_;
+    my $tmpl = $c->req->param('msg');
+    # Test commented-out in 07render.t: TD does not support template text as a
+    # scalar ref, because templates are not text, they're code.
+    $c->stash->{message} = $c->view('AppConfig')->render($c, \$tmpl);
+    $c->stash->{template} = 'test';
+}
+
+sub end : Private {
+    my ($self, $c) = @_;
+
+    return 1 if $c->response->status =~ /^3\d\d$/;
+    return 1 if $c->response->body;
+
+    my $view = 'View::' . ($c->request->param('view') || $c->config->{default_view});
+    $c->forward($view);
+}
+
+1;

Modified: Catalyst-View-TD/trunk/t/lib/TestApp.pm
===================================================================
--- Catalyst-View-TD/trunk/t/lib/TestApp.pm	2009-10-29 19:31:57 UTC (rev 11692)
+++ Catalyst-View-TD/trunk/t/lib/TestApp.pm	2009-10-29 19:36:05 UTC (rev 11693)
@@ -4,7 +4,6 @@
 use warnings;
 
 use Catalyst; # qw/-Debug/;
-use Path::Class;
 
 our $VERSION = '0.01';
 
@@ -20,88 +19,3 @@
 __PACKAGE__->setup;
 
 1;
-
-# package TestApp::Controller::Root;
-# use base 'Catalyst::Controller';
-# BEGIN { $INC{'TestApp/Controller/Root.pm'} = __FILE__ }
-
-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_prepend_dispatchto : Local {
-    my ($self, $c) = @_;
-    $c->stash->{message}  = $c->request->param('message') || $c->config->{default_message};
-    $c->stash->{template} = $c->request->param('template');
-    if ( my $class = $c->request->param('additionalclass') ){
-        $c->stash->{prepend_template_classes} = [$class];
-    }
-    if ( my $class = $c->request->param('addclass') ){
-        my $view = $self->view($c->request->param('view') || $c->config->{default_view});
-        push @{ $view->dispatch_to}, $class;
-    }
-    if ( my $class = $c->request->param('setclass') ){
-        my $view = $self->view($c->request->param('view') || $c->config->{default_view});
-        $view->dispatch_to([$class]);
-    }
-}
-
-sub test_append_dispatchto : Local {
-    my ($self, $c) = @_;
-    $c->stash->{message}  = $c->request->param('message') || $c->config->{default_message};
-    $c->stash->{template} = $c->request->param('template');
-    if ( my $class = $c->request->param('additionalclass') ){
-        $c->stash->{append_template_classes} = [$class];
-    }
-    if ( my $class = $c->request->param('addclass') ){
-        my $view = $self->view($c->request->param('view') || $c->config->{default_view});
-        push @{ $view->dispatch_to}, $class;
-    }
-    if ( my $class = $c->request->param('setclass') ){
-        my $view = $self->view($c->request->param('view') || $c->config->{default_view});
-        $view->dispatch_to([$class]);
-    }
-}
-
-sub test_render : Local {
-    my ($self, $c) = @_;
-
-    my $out = $c->stash->{message} = $c->view('Appconfig')->render(
-        $c, $c->req->param('template'), {param => $c->req->param('param') || ''}
-    );
-    if (ref $out) {
-        $c->response->body($$out);
-        $c->response->status(403);
-    } else {
-        $c->stash->{template} = 'test';
-    }
-
-}
-
-sub test_msg : Local {
-    my ($self, $c) = @_;
-    my $tmpl = $c->req->param('msg');
-    # Test commented-out in 07render.t: TD does not support template text as a
-    # scalar ref, because templates are not text, they're code.
-    $c->stash->{message} = $c->view('AppConfig')->render($c, \$tmpl);
-    $c->stash->{template} = 'test';
-}
-
-sub end : Private {
-    my ($self, $c) = @_;
-
-    return 1 if $c->response->status =~ /^3\d\d$/;
-    return 1 if $c->response->body;
-
-    my $view = 'View::' . ($c->request->param('view') || $c->config->{default_view});
-    $c->forward($view);
-}
-
-1;




More information about the Catalyst-commits mailing list