1 package ChainedActionsApp::Controller::Root;
3 use namespace::autoclean;
5 BEGIN { extends 'Catalyst::Controller' }
8 # Sets the actions in this controller to be registered with no prefix
9 # so they function identically to actions created in MyApp.pm
11 __PACKAGE__->config(namespace => '');
15 test_chained::Controller::Root - Root Controller for test_chained
19 [enter your description here]
25 This is the C<setup> method that initializes the request. Any matching action
26 will go through this, so it is an application-wide automatically executed
27 action. For more information, see L<Catalyst::DispatchType::Chained>
31 sub setup : Chained('/') PathPart('') CaptureArgs(0) {
32 my ( $self, $c ) = @_;
33 # Common things here are to check for ACL and setup global contexts
36 sub home : Chained('setup') PathPart('') Args(0) {
38 $c->response->body( "Application Home Page" );
49 sub home_base : Chained('setup') PathPart('') CaptureArgs(2) {
50 my($self,$c,$proj_id,$title) = @_;
51 $c->stash({project_id=>$proj_id, project_title=>$title});
54 sub hpages : Chained('home_base') PathPart('') Args(0) {
56 $c->response->body( "List project " . $c->stash->{project_title} . " pages");
59 sub hpage : Chained('home_base') PathPart('') Args(2) {
60 my($self,$c,$page_id, $pagetitle) = @_;
61 $c->response->body( "This is $pagetitle page of " . $c->stash->{project_title} . " project" );
64 sub no_account : Chained('setup') PathPart('account') Args(0) {
66 $c->response->body( "New account o login" );
69 sub account_base : Chained('setup') PathPart('account') CaptureArgs(1) {
70 my($self,$c,$acc_id) = @_;
71 $c->stash({account_id=>$acc_id});
74 sub account : Chained('account_base') PathPart('') Args(0) {
75 my($self,$c,$acc) = @_;
76 $c->response->body( "This is account " . $c->stash->{account_id} );
81 Standard 404 error page
85 sub default : Chained('setup') PathPart('') Args() {
86 my ( $self, $c ) = @_;
87 $c->response->body( 'Page not found' );
88 $c->response->status(404);
93 Attempt to render a view, if needed.
97 sub end : ActionClass('RenderView') {}
105 This library is free software. You can redistribute it and/or modify
106 it under the same terms as Perl itself.
110 __PACKAGE__->meta->make_immutable;