[Catalyst] Something odd with chained actions

Robert 'phaylon' Sedlacek phaylon at dunkelheit.at
Mon Jul 10 12:40:31 CEST 2006

Nilson Santos Figueiredo Junior said:
> However, if I use:
>   sub test1 : PathPart('test') Chained('/') CaptureArgs('1') { }
>   sub test2 : PathPart('test2') Chained('test1')  { }
> It understands it correctly and I get:

Yes, 'Chained' takes the private action name. The whole chain creates a
publich path. From the docs:

  "The Chained attribute allows you to chain public path parts
   together by their private names."

> From the docs, I thought that I should use the action PathPart name as
> the attribute to Chained() - it seemed the method name didn't really
> matter (it just happened to be the default PathPart name if you didn't
> specify it). However, in practice, that's not how's it working.

Your problem has nothing to do with the PathPart attribute, the differing
Chained values are the matter. In your two examples, the PathPart
attributes don't even have different values.

> Some weird stuff also happens if you specify PathPart actions as such:
>   sub another_test  : PathPart Chained('/') {}
>   sub another_test2 : PathPart Chained('another_test') {}
> It will result in:

Yes, 'Args' marks an endpoint and is implicit. You probably want a
CaptureArgs attribute here. From the CaptureArgs attribute docs:

  "Must be specified for every part of the chain that is not
   an endpoint."

> But /another_test/another_test2/ isn't actually callable. But this
> latter one is probably an abuse of the chained actions system. ;-)

Kind of :)

hth, p

More information about the Catalyst mailing list