| PackageDescription | This module allows one to apply Moose::Roles to the 'Catalyst::Action's for
different controller methods.
For that a 'Does' attribute is provided. That attribute takes an argument,
that determines the role, which is going to be applied. If that argument is
prefixed with '+', it is assumed to be the full name of the role. If it's
prefixed with '~', the name of your application followed by
'::ActionRole::' is prepended. If it isn't prefixed with '+' or '~', the
role name will be searched for in '@INC' according to the rules for role
prefix searching.
It's possible to apply roles to *all* actions of a controller without
specifying the 'Does' keyword in every action definition:
package MyApp::Controller::Bar
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller::ActionRole' }
__PACKAGE__->config(
action_roles => ['Foo', '~Bar'],
);
sub moo : Local { ... }
Additionally, roles can be applied to selected actions without specifying
'Does' using Catalyst::Controller/action and configured with
Catalyst::Controller/action_args:
package MyApp::Controller::Baz;
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller::ActionRole' }
__PACKAGE__->config(
action_roles => [qw( Foo )],
action => {
some_action => { Does => [qw( ~Bar )] },
another_action => { Does => [qw( +MyActionRole::Baz )] },
},
action_args => {
another_action => { customarg => 'arg1' },
}
);
sub some_action : Local { ... }
sub another_action : Local { ... } |