[Catalyst] Request paths - rejoining Chained actions together.
Matt S Trout
dbix-class at trout.me.uk
Sat May 10 15:12:08 BST 2008
On Fri, May 09, 2008 at 01:00:07PM +0100, Tomas Doran wrote:
> Hi
>
> I'm building quite a complex app, which has a number of ways of
> locating things, and I want to be able to rejoin chains..
>
> Some example URLs:
>
> /volume/*/track/*/format/*
> /track/*format/*
>
> This becomes:
>
> sub tracksequence : Chained('/') PathPart('track') CaptureArgs(1) {}
>
> sub volume : Chained('/') PathPart('volume') CaptureArgs(1) {}
> sub trackonvolume : Chained('volume') CaptureArgs(1) {}
sub format :Chained PathPart('format') Args(1) {}
Inherit that into both controllers.
__PACKAGE__->config(actions => { format => { Chained => 'tracksequence' } });
in one controller, and 'trackonvolume' in the other.
Then you have two format endpoints but one 'sub format'.
Problem solved.
> But this doesn't work...
>
> So what I've got instead is:
>
> sub formattracksequence : Chained('tracksequence') PathPart('format')
> Args(1) { $c->forward('format'); }
> sub formattrackonvolume: Chained('tracksequence', 'trackonvolume')
> PathPart('format') Args(1) { $c->forward('format') }
> sub format : Private {}
>
> Which works fine.. However, this is just a subset of my URL
> complexity, and I have *multiple* points where I want to be able to
> chain one function into two (or more) chains..
>
> My actual URLs look like /volume/track/*/format/*bitrate/*/
> someoperation or track/*/format/*bitrate/*/someoperation
>
> and having to maintain two seperate sets of chains is pretty painful..
>
> Is there any sane way of doing this? Am I missing something obvious?
>
> Cheers
> Tom
>
>
> _______________________________________________
> 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/
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the Catalyst
mailing list