[Catalyst] Chaining on complex PathParts

Eric Wright info at rapidsynergy.com
Tue Jan 6 19:08:14 GMT 2009


Doh! Now it works. I knew I was missing something. Thanks Darius! :-)

On Tue, Jan 6, 2009 at 1:28 PM, Darius Jokilehto <
darius.jokilehto at net-a-porter.com> wrote:

> On Tue, Jan 06, 2009 at 12:36:05PM -0500, Eric Wright wrote:
> > Hiya folks,
> >
> > I just started playing around with chaining and it's very cool. However,
> I'm
> > encountering difficulty with getting something to work the way I want
> where I
> > have different actions at different path depths. Is there something abo=
ut
> > chaining that I don't understand?
> >
> > The following does what I would expect:
> >
>
> < snip >
>
> > sub hello : PathPart('prefix/hello') Chained('/') CaptureArgs(1) {
> >   my ( $self, $c, $integer ) =3D @_;
> >   $c->stash->{ message } =3D "Hello ";
> >   $c->stash->{ arg_sum } =3D $integer;
> > }
> >
> > #   this is our endpoint, because it has no :CaptureArgs
> > sub world : PathPart('world') Chained('prefix/hello') Args(0) {
> >   my ( $self, $c, $integer ) =3D @_;
> >   $c->stash->{ message } .=3D "World!";
> >
> >   $c->response->body( join "<br/>\n" =3D>
> >       $c->stash->{ message }, $c->stash->{ arg_sum } );
> > }
> >
> > In this example all I've done is add "prefix" to the path. In this
> scenario I
> > can request:
> >
> > /prefix/hello/1 (which again fires just_hello)
> > /prefix/hello/1/world (FAILS!)
> >
> > Is it not possible to define chains in this way? Or am I just missing
> something
> > obvious here?
> >
> > Thanks in advance for any insight anyone may have into this.
> >
> > -Eric
> >
>
> Hey Eric,
>
> You need to chain on the sub name as opposed to the path part, so in your
> case:
>
> sub world : PathPart('world') Chained('hello') Args(0) {
> }
>
> D
>
> New to NET-A-PORTER.COM: 6 fabulous boutiques!
> http://www.net-a-porter.com/boutiques
> ______________________________________________________________________
>
> CONFIDENTIALITY NOTICE
> The information in this email is confidential and is intended solely for
> the addressee. Access to this email by anyone else is unauthorised. If you
> are not the intended recipient, you must not read, use or disseminate the
> information. Any views expressed in this message are those of the individ=
ual
> sender, except where the sender specifically states them to be the views =
of
> Net a Porter Ltd.
>
> Net A Porter Ltd is a company registered in England & Wales Number: 38206=
04
> Registered Office: The Dome, Whiteleys Centre, 151 Queensway, London, W2
> 4YN.
> _____________________________________________________________________
>
> _______________________________________________
> 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/
>



-- =

-----------------------------------------------------------
Eric Wright
Rapid Synergy LLC
Web Development, Software & Consulting
V: 203.758.9270  F: 203.725.0853
http://www.rapidsynergy.com
-----------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090106/b2714=
8d3/attachment.htm


More information about the Catalyst mailing list