[Catalyst] Is this right (Chained actions)

John Napiorkowski jjn1056 at yahoo.com
Wed Aug 30 06:33:32 CEST 2006


Hi,

I'm giving my first shot at using this chained action thing and I'm not sure if I have this right.

If I have a catalyst controller like so:

package myapp::templates

[...]

sub pages :Path Args(0)
{
    [...]
}

sub page :Chained('/') PathPart('templates') CaptureArgs(1)
{
    [...]
}

sub view :Chained('page') PathPart('view') Args(0)
{
    [...]
}

sub edit :Chained('page') PathPart('edit') Args(0)
{
    [...]
}

For the pages action it matches "/templates/pages" and for the two chained actions it matches "/templates/*/view" and "/templates/*/edit".  I'm confused about having to specify PathPart('templates') in the page action.  If I leave this empty (PathPart()) It matches "/page/*/(view|edit)" which is different what I might think is would do based on my understanding of the Path attribute, which matches to the action based on the controller namespace if you leave it blank, as I did in the pages action.

So, am I doing this right?  To be honest my intution suggestions that Path and PathPart are very similar and should have similar defaults and the fact that that don't seem to tells me I am not understanding the best way to use this feature.

 Please let me know what you all think!

--john





More information about the Catalyst mailing list