drop namespace::autoclean
[catagits/Catalyst-Runtime.git] / t / lib / ChainedActionsApp / Controller / Root.pm
CommitLineData
6df93c61 1package ChainedActionsApp::Controller::Root;
2use Moose;
eefc03e1 3use namespace::clean -except => [ 'meta' ];
6df93c61 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
6df93c61 13sub setup : Chained('/') PathPart('') CaptureArgs(0) {
14 my ( $self, $c ) = @_;
15 # Common things here are to check for ACL and setup global contexts
16}
17
18sub home : Chained('setup') PathPart('') Args(0) {
19 my($self,$c) = @_;
20 $c->response->body( "Application Home Page" );
21}
22
6df93c61 23sub home_base : Chained('setup') PathPart('') CaptureArgs(2) {
24 my($self,$c,$proj_id,$title) = @_;
444e5611 25 $c->stash({project_id=>$proj_id, project_title=>$title});
6df93c61 26}
27
28sub hpages : Chained('home_base') PathPart('') Args(0) {
29 my($self,$c) = @_;
444e5611 30 $c->response->body( "List project " . $c->stash->{project_title} . " pages");
6df93c61 31}
32
33sub hpage : Chained('home_base') PathPart('') Args(2) {
34 my($self,$c,$page_id, $pagetitle) = @_;
444e5611 35 $c->response->body( "This is $pagetitle page of " . $c->stash->{project_title} . " project" );
6df93c61 36}
37
38sub no_account : Chained('setup') PathPart('account') Args(0) {
39 my($self,$c) = @_;
40 $c->response->body( "New account o login" );
41}
42
43sub account_base : Chained('setup') PathPart('account') CaptureArgs(1) {
44 my($self,$c,$acc_id) = @_;
45 $c->stash({account_id=>$acc_id});
46}
47
48sub account : Chained('account_base') PathPart('') Args(0) {
49 my($self,$c,$acc) = @_;
50 $c->response->body( "This is account " . $c->stash->{account_id} );
51}
52
d4f76f02 53sub profile_base : Chained('setup') PathPart('account/profile') CaptureArgs(1) {
54 my($self,$c,$acc_id) = @_;
55 $c->stash({account_id=>$acc_id});
56}
57
58sub profile : Chained('profile_base') PathPart('') Args(1) {
59 my($self,$c,$acc) = @_;
60 $c->response->body( "This is profile of " . $acc );
61}
62
13f911ef 63=head2 downloads
64
65 This is a different test, this function is void, just to let following in the chain
66 to declare downloads as PathPart.
67
68=cut
69
70sub downloads : Chained('setup') PathPart('') CaptureArgs(0) {
71 my($self,$c) = @_;
72}
73
74sub downloads_index : Chained('downloads') PathPart('downloads') Args(0) {
75 my($self,$c) = @_;
76 $c->response->body( "This is download index");
77}
78
6df93c61 79sub default : Chained('setup') PathPart('') Args() {
80 my ( $self, $c ) = @_;
81 $c->response->body( 'Page not found' );
82 $c->response->status(404);
83}
84
6a75eb0e 85sub end : Action {}
6df93c61 86
87__PACKAGE__->meta->make_immutable;
88
891;