PathPrefix (was: [Catalyst] Anybody using Chained('.') ?)

Robert 'phaylon' Sedlacek rs at 474.at
Tue Mar 13 16:52:24 GMT 2007


Jason Kohles wrote:

> Apparently I misunderstood the relationship between Chained and 
> PathPart, and therefore misunderstood what the documentation was saying 
> here.  So now the way I understand it is that Chained('.') means to 
> setup a chain segment that has as it's parent the chain segment that 
> matches the current controller's namespace.  Apparently what I'm 
> actually looking for is the equivalent of Chained('/') PathPart('.'), 
> meaning I want to build chains that originate in the current namespace.

You can chain your action only to other actions or to the root, not to 
namespaces. The PathPart attribute controls how the path is built 
visibly. There is a :PathPrefix implementation that does what you want 
somewhere in Catalyst's SVN, but I don't know when it is expected to go 
to CPAN.

> But the only way I can find to do this with Chained is by putting 
> something like this in each controller subclass:

You can also put the base in the controller base class and configure it 
via your config file or application class:

   Controller::Foo:
     action:
       base:
         PathPart: 'foo/bar/baz'

(untested again, there is an example in the Advent Calendar for 2006)

-- 
# Robert 'phaylon' Sedlacek
# Perl 5/Catalyst Developer in Hamburg, Germany
{ EMail => ' rs at 474.at ', Web => ' http://474.at ' }



More information about the Catalyst mailing list