[Catalyst] Multiple Chain Actions

Alexander Hartmaier alexander.hartmaier at t-systems.at
Fri Jul 17 16:29:16 GMT 2009


Why not use the same uri and check the Accept header?

Am Donnerstag, den 16.07.2009, 21:22 +0200 schrieb Tomas Doran:
> 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
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
--
LG Alex


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*



More information about the Catalyst mailing list