Commit | Line | Data |
aa7921c5 |
1 | use CatalystX::Declare; |
2 | |
3 | # we consume a role that does what the RenderView action class |
4 | # would normally do |
5 | controller MyApp::Web::Controller::Root |
6 | with MyApp::Web::ControllerRole::RenderView { |
7 | |
8 | # $CLASS is provided by CLASS.pm |
5a494dae |
9 | $CLASS->config(namespace => ''); |
aa7921c5 |
10 | |
11 | |
12 | # this is the common root action for all other actions |
13 | action base under '/' as ''; |
14 | |
15 | # we group all our root actions under the common base |
16 | under base { |
17 | |
18 | # this action catches / |
19 | final action root as '' { |
20 | |
21 | $ctx->response->body( $ctx->welcome_message ); |
22 | } |
23 | |
24 | # this action takes all other /* parts. the (@) signature |
25 | # says we don't care about the arguments |
26 | final action not_found (@) as '' { |
27 | |
28 | $ctx->response->body( 'Page Not Found' ); |
29 | $ctx->response->status( 404 ); |
30 | } |
31 | } |
32 | } |