Modify Root controller skeleton to use Chained actions.
[catagits/Catalyst-Devel.git] / share / lib / MyApp / Controller / Root.pm.tt
CommitLineData
239b5fc0 1package [% rootname %];
8662edf6 2use Moose;
3use namespace::autoclean;
239b5fc0 4
8662edf6 5BEGIN { extends 'Catalyst::Controller' }
239b5fc0 6
7#
8# Sets the actions in this controller to be registered with no prefix
9# so they function identically to actions created in MyApp.pm
10#
3e5f7783 11__PACKAGE__->config(namespace => '');
239b5fc0 12
13=head1 NAME
14
15[% rootname %] - Root Controller for [% name %]
16
17=head1 DESCRIPTION
18
19[enter your description here]
20
21=head1 METHODS
22
3e27a49e 23=head2 base
24
25The root of the chain, offers flexibility to the below actions depending on
26whether / has an argument (sub default) or not (sub index).
27
28=cut
29
30sub base :Chained('/') PathPart('') CaptureArgs(0) {
31 # Intentionally blank but you might want to do something here.
32}
33
239b5fc0 34=head2 index
35
3e27a49e 36The root page (/) of the site.
3d3e34a0 37
239b5fc0 38=cut
39
3e27a49e 40sub index :Chained('/base') PathPart('') Args(0) {
239b5fc0 41 my ( $self, $c ) = @_;
42
43 # Hello World
44 $c->response->body( $c->welcome_message );
45}
46
3d3e34a0 47=head2 default
48
49Standard 404 error page
50
51=cut
52
3e27a49e 53sub default : Chained('/base') PathPart('') Args {
239b5fc0 54 my ( $self, $c ) = @_;
55 $c->response->body( 'Page not found' );
56 $c->response->status(404);
57}
58
59=head2 end
60
61Attempt to render a view, if needed.
62
63=cut
64
65sub end : ActionClass('RenderView') {}
66
67=head1 AUTHOR
68
69[% author %]
70
71=head1 LICENSE
72
73This library is free software. You can redistribute it and/or modify
74it under the same terms as Perl itself.
75
76=cut
77
8662edf6 78__PACKAGE__->meta->make_immutable;
7e6d9ba3 79
801;