$self->_ensure_applied_dispatchtype_roles;
}
+
around gather_action_roles(%args) {
return (
$self->$orig(%args),
- @{ delete($args{attributes}{CatalystX_Declarative_ActionRoles}) || [] },
+ (map {
+ $self->_qualify_class_name(ActionRole => $_);
+ #$self->_expand_role_shortname($_);
+ } @{ delete($args{attributes}{CatalystX_Declarative_ActionRoles}) || [] }),
+ @{ delete($args{attributes}{CatalystX_Declarative_DefaultActionRoles}) || [] },
);
}
around create_action (%args) {
my $action = $self->$orig(%args);
+ ## TODO Do we really need this anymore?
return $action
if $args{attributes}{Private};
$attrs->{Signature} = $proto;
$attrs->{Action} = [];
- push @{ $attrs->{CatalystX_Declarative_ActionRoles} ||= [] }, CatchValidationError;
+ push @{ $attrs->{CatalystX_Declarative_DefaultActionRoles} ||= [] }, CatchValidationError;
# default chained base to the global under var, to be resolved at runtime
$attrs->{Chained} ||= UNDER_VAR;
is get('/actionparams/third'), 'action_args_third: 300,301', 'actionrole with params (part three)';
is get('/actionparams/forth'), 'action_args_forth: 400,1,401,2', 'actionrole with params (part four)';
+is get('/actionparams/first_app_ns'), 'action_args_first: 100,101', 'actionrole with params (from App NS)';
+is get('/actionparams/first_cat_ns'), 'action_args_first: 100,101', 'actionrole with params (from Cat NS)';
+
done_testing;
--- /dev/null
+package Catalyst::ActionRole::hasActionParams_CatNS;
+use Moose::Role;
+
+has [qw/p1 p2/] => (is=>'ro', lazy_build=>1);
+
+sub _build_p1 {
+ my $self = shift @_;
+ return join ',', @{$self->attributes->{p1}};
+}
+
+sub _build_p2 {
+ my $self = shift @_;
+ return join ',', @{$self->attributes->{p2}};
+}
+
+1;
--- /dev/null
+use CatalystX::Declare;
+namespace TestApp;
+role ::ActionRole::hasActionParams_AppNS {
+ has [qw/p1 p2/] => (is=>'ro', lazy_build=>1);
+ method _build_p1 {
+ join ',', @{$self->attributes->{p1}};
+ }
+ method _build_p2 {
+ join ',', @{$self->attributes->{p2}};
+ }
+}
+
as 'actionparams';
action first under base
- with hasActionParams(p1=>100,p2=>101)
- is final {
+ with hasActionParams(p1=>100,p2=>101)
+ is final {
my $p1 = $ctx->controller->action_for('first')->p1;
my $p2 = $ctx->controller->action_for('first')->p2;
$ctx->response->body("action_args_first: $p1,$p2");
}
action second under base
- with hasActionParams({p1=>200,p2=>201})
+ with hasActionParams({p1=>200,p2=>201})
is final {
my $p1 = $ctx->controller->action_for('second')->p1;
my $p2 = $ctx->controller->action_for('second')->p2;
my $p2 = $ctx->controller->action_for('forth')->p2;
$ctx->response->body("action_args_forth: $p1,$p2");
}
+
+ action first_app_ns under base
+ with hasActionParams_AppNS(p1=>100,p2=>101)
+ is final {
+ my $p1 = $ctx->controller->action_for('first')->p1;
+ my $p2 = $ctx->controller->action_for('first')->p2;
+ $ctx->response->body("action_args_first: $p1,$p2");
+ }
+
+ action first_cat_ns under base
+ with hasActionParams_CatNS(p1=>100,p2=>101)
+ is final {
+ my $p1 = $ctx->controller->action_for('first')->p1;
+ my $p2 = $ctx->controller->action_for('first')->p2;
+ $ctx->response->body("action_args_first: $p1,$p2");
+ }
+
}