[Catalyst] Multiple Chain Actions
Tomas Doran
bobtfish at bobtfish.net
Thu Jul 16 19:22:20 GMT 2009
On 16 Jul 2009, at 16:30, Derek Wueppelmann wrote:
>
> sub json : Chained('/') ChainedArgs(0) {
> my ($self, $c) = @_;
>
> Is this something that is possible? Should I even be using Chaining
> for
> this? Any help would be appreciated.
Call your top level path part root, then inherit (or apply as a role)
the rest of the chain parts.
e.g.
package MyApp::Stuff;
use Moose::Role -traits => 'MethodAttributes';
sub thingie : Chained('root') PathPart('thingie') Args(0) {}
package MyApp::Controller::Root;
with 'MyApp::Stuff';
sub root : Chained('/') PathPart('') CaptureArgs(0) {}
package MyApp::Controller::JSON;
with 'MyApp::Stuff';
sub root : Chained('/') PathPart('json') CaptureArgs(0) {}
Will give you:
/thingie
and
/json/thingie
Cheers
t0m
More information about the Catalyst
mailing list