[Catalyst] Request paths - rejoining Chained actions together.

J. Shirley jshirley at gmail.com
Fri May 9 15:55:04 BST 2008


On Fri, May 9, 2008 at 5:00 AM, Tomas Doran <bobtfish at bobtfish.net> 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('tracksequence', 'trackonvolume') PathPart('format')
> Args(1) {}
>
> 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
>


It sounds like your actions are capture arguments, rather than
separate midpoints (since they're working on the same resource,
anyway).

If you have someoperation as a CaptureArg, and stick that away in the
stash to perform the action later in the chain, you should get what
you want.

-J



More information about the Catalyst mailing list