push @{ $self->{$modifier}->{$method_name} ||= [] }, $method;
return;
};
+ my $has_method_modifiers = sub{
+ my($self, $method_name) = @_;
+ my $m = $self->{$modifier}->{$method_name};
+ return $m && @{$m} != 0;
+ };
my $get_method_modifiers = sub {
my ($self, $method_name) = @_;
return @{ $self->{$modifier}->{$method_name} ||= [] }
no strict 'refs';
*{ 'add_' . $modifier_type . '_method_modifier' } = $add_method_modifier;
+ *{ 'has_' . $modifier_type . '_method_modifiers' } = $has_method_modifiers;
*{ 'get_' . $modifier_type . '_method_modifiers' } = $get_method_modifiers;
}
(defined $role_name)
|| confess "You must supply a role name to does()";
- my $meta = $self->meta;
- foreach my $class ($meta->linearized_isa) {
- my $m = ref($meta)->initialize($class);
- return 1
- if $m->can('does_role') && $m->does_role($role_name);
- }
- return 0;
+ return $self->meta->does_role($role_name);
};
1;