Checks for any action now.
[catagits/Catalyst-Runtime.git] / t / lib / ChainedActionsApp / Controller / Root.pm
CommitLineData
6df93c61 1package ChainedActionsApp::Controller::Root;
2use Moose;
3use namespace::autoclean;
4
5BEGIN { extends 'Catalyst::Controller' }
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#
11__PACKAGE__->config(namespace => '');
12
13=head1 NAME
14
15test_chained::Controller::Root - Root Controller for test_chained
16
17=head1 DESCRIPTION
18
19[enter your description here]
20
21=head1 METHODS
22
23=head2 setup
24
25This is the C<setup> method that initializes the request. Any matching action
26will go through this, so it is an application-wide automatically executed
27action. For more information, see L<Catalyst::DispatchType::Chained>
28
29=cut
30
31sub setup : Chained('/') PathPart('') CaptureArgs(0) {
32 my ( $self, $c ) = @_;
33 # Common things here are to check for ACL and setup global contexts
34}
35
36sub home : Chained('setup') PathPart('') Args(0) {
37 my($self,$c) = @_;
38 $c->response->body( "Application Home Page" );
39}
40
41=head2 home_base
42
43 Args:
44 project_id
45 project_title
46
47=cut
48
49sub home_base : Chained('setup') PathPart('') CaptureArgs(2) {
50 my($self,$c,$proj_id,$title) = @_;
444e5611 51 $c->stash({project_id=>$proj_id, project_title=>$title});
6df93c61 52}
53
54sub hpages : Chained('home_base') PathPart('') Args(0) {
55 my($self,$c) = @_;
444e5611 56 $c->response->body( "List project " . $c->stash->{project_title} . " pages");
6df93c61 57}
58
59sub hpage : Chained('home_base') PathPart('') Args(2) {
60 my($self,$c,$page_id, $pagetitle) = @_;
444e5611 61 $c->response->body( "This is $pagetitle page of " . $c->stash->{project_title} . " project" );
6df93c61 62}
63
64sub no_account : Chained('setup') PathPart('account') Args(0) {
65 my($self,$c) = @_;
66 $c->response->body( "New account o login" );
67}
68
69sub account_base : Chained('setup') PathPart('account') CaptureArgs(1) {
70 my($self,$c,$acc_id) = @_;
71 $c->stash({account_id=>$acc_id});
72}
73
74sub account : Chained('account_base') PathPart('') Args(0) {
75 my($self,$c,$acc) = @_;
76 $c->response->body( "This is account " . $c->stash->{account_id} );
77}
78
79=head2 default
80
81Standard 404 error page
82
83=cut
84
85sub default : Chained('setup') PathPart('') Args() {
86 my ( $self, $c ) = @_;
87 $c->response->body( 'Page not found' );
88 $c->response->status(404);
89}
90
91=head2 end
92
93Attempt to render a view, if needed.
94
95=cut
96
97sub end : ActionClass('RenderView') {}
98
99=head1 AUTHOR
100
101Ferruccio Zamuner
102
103=head1 LICENSE
104
105This library is free software. You can redistribute it and/or modify
106it under the same terms as Perl itself.
107
108=cut
109
110__PACKAGE__->meta->make_immutable;
111
1121;