[Catalyst-dev] Plugin or controller? - How about a Role?

Tomas Doran bobtfish at bobtfish.net
Wed Jun 3 09:20:55 GMT 2009


Zbigniew Lukasiak wrote:
> A question to the core devs - could that be a controller role?  I
> don't see anything preventing that - but I haven't yet gained any
> experience in writing for Moosified Catalyst.   I ask this question
> because there is, quite common, opinion that roles can be cleaner in
> many way than base controllers - so I wonder why this is not advised
> here.

Yes, it totally could.

Especially if your controller things are implemented as chained path 
parts, this is an extremely powerful technique.

I was keeping quiet until I got chance to blog about a larger / more 
complex example, which would better illustrate the question actually 
posed, but given you brought it up anyway:

http://bobtfish.livejournal.com/264317.html
http://bobtfish.livejournal.com/264605.html

you want Cat 5.80003 and MooseX::MethodAttributes 0.12 or higher for it 
to work right, but given you're running those it works well.

I'm currently porting some work code which has really complex structures 
of repeated url hierarchies to use roles, rather than fairly involved 
multiple inheritance, and the code is getting much easier for my brain 
to understand as I go..

Cheers
t0m



More information about the Catalyst-dev mailing list