[Catalyst] Using Action::REST and Controller::ActionRole together?

Miquel Ruiz self at miquelruiz.net
Sat May 26 16:34:03 GMT 2012

Hi all,

I would like to mix in the same action some custom ActionRoles (via 
Catalyst::Controller::ActionRole) and Catalyst::Action::REST.

I gave it a try in a test application, but the action roles are getting 
applied to both the main action and the method-specific action:

# Main action
sub index :Path :Args(0) :Does('Role1') :Does('Role2') 
:ActionClass('REST') {

# GET specific action
sub index_GET {

In this scenario, I'm getting Role1 and Role2 functions executed twice, 
which is not desired.

I wonder if someone out there is using it (or another approach which 
provides the same features), and if there is a sane way to mix both 
functionalities without shoot myself in the foot

Maybe would be interesting to have a Catalyst::ActionRole::REST, 
providing the same features than Catalyst::Action::REST, but 
encapsulated in a role?

If I'm saying something silly, or if I'm missing some point which makes 
this impossible, please let me know.

Thanks in advance for your comments!

Miquel Ruiz

More information about the Catalyst mailing list