Fix up a bit, still needs compclass.tt doing
[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
c7365a5d 25The root of the chain, common app-wide functionality generally goes here.
3e27a49e 26
27=cut
28
29sub base :Chained('/') PathPart('') CaptureArgs(0) {
30 # Intentionally blank but you might want to do something here.
31}
32
239b5fc0 33=head2 index
34
3e27a49e 35The root page (/) of the site.
3d3e34a0 36
239b5fc0 37=cut
38
3e27a49e 39sub index :Chained('/base') PathPart('') Args(0) {
239b5fc0 40 my ( $self, $c ) = @_;
41
42 # Hello World
43 $c->response->body( $c->welcome_message );
44}
45
3d3e34a0 46=head2 default
47
c7365a5d 48The default (catch-all) action. Detaches control to the C<not_found>
49action to generate a 404 page.
3d3e34a0 50
51=cut
52
3e27a49e 53sub default : Chained('/base') PathPart('') Args {
239b5fc0 54 my ( $self, $c ) = @_;
c7365a5d 55 $c->detach('not_found');
56}
57
58=head2 not_found
59
60Simple 404 error page.
61
62=cut
63
64sub not_found : Action {
65 my ( $self, $c ) = @_;
239b5fc0 66 $c->response->body( 'Page not found' );
67 $c->response->status(404);
68}
69
70=head2 end
71
72Attempt to render a view, if needed.
73
74=cut
75
76sub end : ActionClass('RenderView') {}
77
78=head1 AUTHOR
79
80[% author %]
81
82=head1 LICENSE
83
84This library is free software. You can redistribute it and/or modify
85it under the same terms as Perl itself.
86
87=cut
88
8662edf6 89__PACKAGE__->meta->make_immutable;
7e6d9ba3 90
911;