with 'MooseX::ClassAttribute::Trait::Application';
-sub _apply_class_attributes {
+around apply => sub {
+ my $orig = shift;
my $self = shift;
my $role = shift;
my $class = shift;
},
);
+ $self->$orig( $role, $class );
+};
+
+sub _apply_class_attributes {
+ my $self = shift;
+ my $role = shift;
+ my $class = shift;
+
my $attr_metaclass = $class->attribute_metaclass();
foreach my $attribute_name ( $role->get_class_attribute_list() ) {
with 'MooseX::ClassAttribute::Trait::Application';
-sub _apply_class_attributes {
+around apply => sub {
+ my $orig = shift;
my $self = shift;
my $role1 = shift;
my $role2 = shift;
},
);
+ $self->$orig( $role1, $role2 );
+};
+
+sub _apply_class_attributes {
+ my $self = shift;
+ my $role1 = shift;
+ my $role2 = shift;
+
foreach my $attribute_name ( $role1->get_class_attribute_list() ) {
if ( $role2->has_class_attribute($attribute_name)
&& $role2->get_class_attribute($attribute_name)
}
}
-is_deeply(
- [ map { $_->name() } ClassWithRoleHCA->meta()->calculate_all_roles() ],
- ['RoleHCA'],
+ok(
+ ClassWithRoleHCA->meta()->does_role('RoleHCA'),
'ClassWithRoleHCA does RoleHCA'
);
ClassWithRoleHCA->meta()->make_immutable();
-is_deeply(
- [ map { $_->name() } ClassWithRoleHCA->meta()->calculate_all_roles() ],
- ['RoleHCA'],
+ok(
+ ClassWithRoleHCA->meta()->does_role('RoleHCA'),
'ClassWithRoleHCA (immutable) does RoleHCA'
);
with 'RoleHCA';
}
+ok(
+ RoleWithRoleHCA->meta()->does_role('RoleHCA'),
+ 'RoleWithRoleHCA does RoleHCA'
+);
+
{
package ClassWithRoleWithRoleHCA;
}
}
-is_deeply(
- [ map { $_->name() } ClassWithRoleHCA->meta()->calculate_all_roles() ],
- ['RoleHCA'],
+ok(
+ ClassWithRoleWithRoleHCA->meta()->does_role('RoleHCA'),
'ClassWithRoleWithRoleHCA does RoleHCA'
);
ClassWithRoleWithRoleHCA->meta()->make_immutable();
-is_deeply(
- [ map { $_->name() } ClassWithRoleHCA->meta()->calculate_all_roles() ],
- ['RoleHCA'],
+ok(
+ ClassWithRoleWithRoleHCA->meta()->does_role('RoleHCA'),
'ClassWithRoleWithRoleHCA (immutable) does RoleHCA'
);
apply_all_roles( $instance, 'RoleHCA' );
-is_deeply(
- [ map { $_->name() } $instance->meta()->calculate_all_roles() ],
- ['RoleHCA'],
+ok(
+ $instance->meta()->does_role('RoleHCA'),
'$instance does RoleHCA'
);
$instance->meta()->make_immutable();
-is_deeply(
- [ map { $_->name() } $instance->meta()->calculate_all_roles() ],
- ['RoleHCA'],
+ok(
+ $instance->meta()->does_role('RoleHCA'),
'$instance (immutable) does RoleHCA'
);