Modify Root controller skeleton to use Chained actions.
Antony Gelberg [Wed, 2 Jun 2010 12:50:13 +0000 (15:50 +0300)]
Changes
share/lib/MyApp/Controller/Root.pm.tt

diff --git a/Changes b/Changes
index 02f6532..0af0a83 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,6 @@
 This file documents the revision history for Perl extension Catalyst-Devel.
 
+        - Modify Root controller template to use Chained actions.  (antgel)
         - Fix link in the Pod for Catalyst::Restarter (RT#57362)
         - Fix the pod-coverage version required by the generated app tests.
         - Fix the restarter to only act upon file events (and ergo ignore
index e911ca8..95a08d4 100644 (file)
@@ -20,13 +20,24 @@ __PACKAGE__->config(namespace => '');
 
 =head1 METHODS
 
+=head2 base
+
+The root of the chain, offers flexibility to the below actions depending on
+whether / has an argument (sub default) or not (sub index).
+
+=cut
+
+sub base :Chained('/') PathPart('') CaptureArgs(0) {
+    # Intentionally blank but you might want to do something here.
+}
+
 =head2 index
 
-The root page (/)
+The root page (/) of the site.
 
 =cut
 
-sub index :Path :Args(0) {
+sub index :Chained('/base') PathPart('') Args(0) {
     my ( $self, $c ) = @_;
 
     # Hello World
@@ -39,7 +50,7 @@ Standard 404 error page
 
 =cut
 
-sub default :Path {
+sub default : Chained('/base') PathPart('') Args {
     my ( $self, $c ) = @_;
     $c->response->body( 'Page not found' );
     $c->response->status(404);