From: Dave Rolsky Date: Fri, 16 Sep 2011 15:50:00 +0000 (-0500) Subject: Don't throw an error when a delegation overrides a stub X-Git-Tag: 2.0300~59 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=906b9dad05d637021ac89a430e62206446741f98;p=gitmo%2FMoose.git Don't throw an error when a delegation overrides a stub --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index e97a5df..5b78fd4 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -1084,10 +1084,12 @@ sub install_delegation { my $class_name = $associated_class->name; my $name = "${class_name}::${handle}"; - ( !$associated_class->has_method($handle) ) - || $self->throw_error( - "You cannot overwrite a locally defined method ($handle) with a delegation", - method_name => $handle ); + if ( my $method = $associated_class->get_method($handle) ) { + $self->throw_error( + "You cannot overwrite a locally defined method ($handle) with a delegation", + method_name => $handle + ) unless $method->is_stub; + } # NOTE: # handles is not allowed to delegate