[Catalyst] Something odd with chained actions
Matt S Trout
dbix-class at trout.me.uk
Mon Jul 10 19:56:03 CEST 2006
Nilson Santos Figueiredo Junior wrote:
> On 7/10/06, Robert 'phaylon' Sedlacek <phaylon at dunkelheit.at> wrote:
>> 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."
>
> Hmmm... right. Then it's a little less powerful than I thought, I guess.
No, it's more powerful than you thought :)
Tying it to the PathPart means you're back to being tied to your URI map; this
way if marketing suddenly decide to rename 'products' to 'XPeriences' and
require this to be in the URL, providing you're using $c->uri_for($action,
...) everywhere all you have to do is change one :PathPart statement (which
can even be done from config) and the job's complete.
Also, you can quite happily have an action with :PathPart('') which can be
extremely handy (for e.g. an app where the first path part is the language, or
the username ala livejournal, or whatever)
> If they were chained by their respective PathParts then you could have
> many different chain roots, each possibly accepting a different number
> arguments, which would be followed by the same endpoint. Thus,
> reusability would be improved.
Controller subclassing will handle this fine.
> But I didn't really use it yet so I can't really tell if, in practice,
> this feature would prove itself useful or not. Right now, it seemed to
> be (at least for me).
The feature's there. You just tried to get at it the wrong way :)
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Catalyst
mailing list