use Sub::Name 'subname';
use Devel::GlobalDestruction 'in_global_destruction';
-our $VERSION = '0.89';
+our $VERSION = '0.90';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
# and now make sure to wrap it
# even if it is already wrapped
# because we need a new sub ref
- $method = $wrapped_metaclass->wrap($method);
+ $method = $wrapped_metaclass->wrap($method,
+ package_name => $self->name,
+ name => $method_name,
+ );
}
else {
# now make sure we wrap it properly
- $method = $wrapped_metaclass->wrap($method)
- unless $method->isa($wrapped_metaclass);
+ $method = $wrapped_metaclass->wrap($method,
+ package_name => $self->name,
+ name => $method_name,
+ ) unless $method->isa($wrapped_metaclass);
}
$self->add_method($method_name => $method);
return $method;
(defined $method_name && $method_name)
|| confess "You must define a method name to find";
foreach my $class ($self->linearized_isa) {
- # fetch the meta-class ...
- my $meta = $self->initialize($class);
- return $meta->get_method($method_name)
- if $meta->has_method($method_name);
+ my $method = $self->initialize($class)->get_method($method_name);
+ return $method if defined $method;
}
return;
}
my @cpl = $self->linearized_isa;
shift @cpl; # discard ourselves
foreach my $class (@cpl) {
- # fetch the meta-class ...
- my $meta = $self->initialize($class);
- return $meta->get_method($method_name)
- if $meta->has_method($method_name);
+ my $method = $self->initialize($class)->get_method($method_name);
+ return $method if defined $method;
}
return;
}
Class::MOP::load_class($trait);
for my $meth ( Class::MOP::Class->initialize($trait)->get_all_methods ) {
my $meth_name = $meth->name;
- next if $immutable_meta->has_method( $meth_name );
if ( $immutable_meta->find_method_by_name( $meth_name ) ) {
$immutable_meta->add_around_method_modifier( $meth_name, $meth->body );