On Mon, Jul 6, 2009 at 3:33 PM, Eric Wright <[email protected]> wrote:

> I'm just wondering if any Catalyst programmers have used polymorphism in
> the construction of their controller classes. Coming from a Java background
> I'd like to be a little more OOP about how I implement my controllers. i.e.
> I'd like to be able have a parent controller with common behavior and
> override that behavior as necessary in my child classes but still work with
> the generic parent class.
>
> However, I've gotten in the habit of using actions for my application flow.
> I know it's possible to use chained actions to carry behavior down and I've
> used that in certain situations but it's not truly polymorphic for generic
> coding. I'm not sure if I could be utilizing the NEXT library to more
> advantage. Any thoughts, comments, best practices, tips you've discovered,
> etc?
>
> -Eric
>
>
>
Moose method modifiers work just fine on Catalyst code, which I find to
really help with using inheritance upstream.  You'll probably want to

A typical method that I use is to combine Catalyst::Controller::DBIC::API
with a Moose control that has before/after methods.

Works like a charm.  You may also want to play with using Roles, rather than
an inheritance mess... I find it a little bit easier to have deterministic
code paths to follow after I forgot the code in question.

Please give this a read: http://bobtfish.livejournal.com/264605.html

Our wonderful t0m (Thomas Doran) wrote that up, and I think it should be
required reading for anybody pondering questions like this.

-J
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to