[Catalyst] Polymorphism?

J. Shirley jshirley at gmail.com
Mon Jul 6 22:58:41 GMT 2009


On Mon, Jul 6, 2009 at 3:33 PM, Eric Wright <info at rapidsynergy.com> wrote:

> I'm just wondering if any Catalyst programmers have used polymorphism in
> the construction of their controller classes. Coming from a Java backgrou=
nd
> 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 wi=
th
> the generic parent class.
>
> However, I've gotten in the habit of using actions for my application flo=
w.
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090706/2fc24=
661/attachment.htm


More information about the Catalyst mailing list