On Fri, Aug 28, 2009 at 10:29 AM, Tomas Doran <bobtf...@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
mose...@hank.org
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to