From: Hans Dieter Pearcey Date: Fri, 12 Oct 2007 03:33:22 +0000 (+0000) Subject: let wrapped/overridden methods be inherited instead of only local; complain more... X-Git-Tag: 0_27~26 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=723d3b85e0a367c6f375906e3006e9d7e70ea702;p=gitmo%2FMoose.git let wrapped/overridden methods be inherited instead of only local; complain more accurately about attributes when methods are required --- diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index cf74e9b..317689c 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -412,16 +412,16 @@ sub _check_required_methods { # not satisfy the requirements ... my $method = $other->find_method_by_name($required_method_name); # check if it is an override or a generated accessor .. - (!$method->isa('Moose::Meta::Method::Overriden') && - !$method->isa('Class::MOP::Method::Accessor')) - || confess "'" . $self->name . "' requires the method '$required_method_name' " . - "to be implemented by '" . $other->name . "', the method is only a method modifier"; + ($method->isa('Class::MOP::Method::Accessor')) + && confess "'" . $self->name . "' requires the method '$required_method_name' " . + "to be implemented by '" . $other->name . "', the method is only an attribute"; # before/after/around methods are a little trickier # since we wrap the original local method (if applicable) # so we need to check if the original wrapped method is # from the same package, and not a wrap of the super method - if ($method->isa('Class::MOP::Method::Wrapped')) { - ($method->get_original_method->package_name eq $other->name) + if ($method->isa('Class::MOP::Method::Wrapped') || + $method->isa('Moose::Meta::Method::Overriden')) { + ($other->name->isa($method->get_original_method->package_name)) || confess "'" . $self->name . "' requires the method '$required_method_name' " . "to be implemented by '" . $other->name . "', the method is only a method modifier"; }