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.

Is there a reason to use one over another?

Last I looked, an action is limited to a single ActionClass (although it's easy to deal with that), but depending on how it's done, could apply multiple roles.

Catalyst::Controller::ActionRole gets around this, you can apply many roles to your action.

That is, one way would be to define the end() method in the role and not even have it in the consuming controller class, or another would be to have a end() stub in the controller and and then use "before 'end'" in the role. That way multiple roles could be applied.

Yep, that also totally works.

Is everything going to be a role at some point? ;)

Not _everything_, but yes - a lot of stuff..

Cheers
t0m


_______________________________________________
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