[Catalyst] Is this right (Chained actions)

John Napiorkowski jjn1056 at yahoo.com
Wed Aug 30 17:34:02 CEST 2006


Okay, 

Maybe a more simple explanation of my question.  The documentation talkes about using relative paths in the Chain attribute, however the :Chained('.') doesn't work unless there is already a :Chained('/') for it to find.  So if I want to match, "/templates/*" I can do the following (somewhat contrived example follows):

package myapp::templates

sub templates :Chained Args(1)
{
    [...]
}

or if I want better control of the action name I can do:


package myapp::templates
 
 sub list:Chained PathPart('templates') Args(1)
 {
     [...]
 }

What I'd like to do is:

package myapp::templates
  
  sub list:Chained PathPart('.') Args(1)
  {
      [...]
  }

So that I get a way to start a chain from the current controller's namespace without having to hardcode part of the namespace. However in this last example what actually gets matched is "/./*" (it actually matches on the "." as a literal).

So I guess my confusion is in how differently the Path and PathPart attribute work.  The Path attribute defaults to matching the controller's namespace but :PathPart acts more like :Local in that it matches to the action name. I wish there was a good way to do something like the third example but I'm not seeing it.  What do you all think of this behavior and does anyone have a good way to get a chain rooted to the controller namespace without have to hardcode some part of the controller name?  I'd like this for some custom controllers I am making.

--john






More information about the Catalyst mailing list