[Catalyst] ActionClass vs. Moose Role?

Bill Moseley moseley at hank.org
Fri Aug 28 18:05:51 GMT 2009

On Fri, Aug 28, 2009 at 10:29 AM, Tomas Doran <bobtfish at bobtfish.net> wrote:

> On 28 Aug 2009, at 18:25, Bill Moseley wrote:
>  I was starting to implement a custom ActionClass (similar to RenderView)
>> and then wondered if it would be better written as a Moose role.
> Maybe - depends what you're doing. They're doing different things really,
> and I'd need more details to make a recommendation.

Well, if you were going to write something like RenderView now would you
still write it as an ActionClass?

The purpose is to have a standard end() that I use in multiple applications
-- similar to RenderView as I mentioned.

I guess the difference is if you want to apply code to any action vs. a
specific action.  RenderView is typically applied just to the end() method
(or a method forwarded to from end() ), so maybe it's really better as a
role since it would always alter end().

But if I want to apply code to different (and specific) actions then
ActionClass is probably better since it can be set per action.

Anyway, using "before 'end'" is probably the way to go in the role instead
of "sub end".

BTW -- will the helpers for catalyst.pl start generating Moose-ified context
and controller classes at some point soon?

-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090828/74906=

More information about the Catalyst mailing list