1 use CatalystX::Declare;
3 # a normal controller example
4 controller MyApp::Web::Controller::Foo {
6 # this local base action chains to the root /base action
7 action base under '/base' as 'foo';
9 # all that's below base
14 $ctx->stash(hello => 'rendering via root controller role');
17 # collecto two ints from the uri
18 action nums (Int $x, Int $y) as '' under base {
20 # stash the two values
21 $ctx->stash(x => $x, y => $y);
24 # the nums action above has to two chain parts below it
27 # one end-point where we add the numbers
28 final action add { $ctx->res->body( $ctx->stash->{x} + $ctx->stash->{y} ) }
30 # and one end-point where we multiply them
31 final action multiply { $ctx->res->body( $ctx->stash->{x} * $ctx->stash->{y} ) }