Modify Root controller skeleton to use Chained actions.
[catagits/Catalyst-Devel.git] / share / lib / MyApp / Controller / Root.pm.tt
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);