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 about
> 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 ) = @_;
> $c->stash->{ message } = "Hello ";
> $c->stash->{ arg_sum } = $integer;
> }
>
> # this is our endpoint, because it has no :CaptureArgs
> sub world : PathPart('world') Chained('prefix/hello') Args(0) {
> my ( $self, $c, $integer ) = @_;
> $c->stash->{ message } .= "World!";
>
> $c->response->body( join "<br/>\n" =>
> $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 individual 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: 3820604
Registered Office: The Dome, Whiteleys Centre, 151 Queensway, London, W2 4YN.
_____________________________________________________________________
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/