use Scalar::Util 'blessed', 'weaken';
use overload ();
-our $VERSION = '0.83';
+our $VERSION = '0.84';
our $AUTHORITY = 'cpan:STEVAN';
use Moose::Meta::Method::Accessor;
|| ($self->_is_metadata || '') eq 'bare'
) {
Carp::cluck(
- 'Attribute (' . $self->name . ') has no associated methods'
+ 'Attribute (' . $self->name . ') of class '
+ . $self->associated_class->name
+ . ' has no associated methods'
. ' (did you mean to provide an "is" argument?)'
. "\n"
)
my $self = shift;
my ($type, $accessor, $generate_as_inline_methods) = @_;
$accessor = (keys %$accessor)[0] if (ref($accessor)||'') eq 'HASH';
- if ($self->associated_class->has_method($accessor)
- && !$self->associated_class->get_method($accessor)->isa('Class::MOP::Method::Accessor')) {
+ my $method = $self->associated_class->get_method($accessor);
+ if ($method && !$method->isa('Class::MOP::Method::Accessor')
+ && (!$self->definition_context
+ || $method->package_name eq $self->definition_context->{package})) {
Carp::cluck(
"You cannot overwrite a locally defined method ($accessor) with "
. "an accessor"