Subject: | no warning about overwriting a locally defined method with an accessor in a Role |
This code runs without any warning about overwriting as sub with an
accessor:
package Foo;
use Moose::Role;
has bar => (
is => 'rw',
default => "has bar",
);
sub bar {
return "sub bar";
}
package Self;
use Moose;
with 'Foo';
package main;
my $self = Self->new;
print $self->bar;
Doing a similar but within a Moose class:
package Foo;
use Moose;
has bar => (
is => 'rw',
default => "has bar",
);
sub bar {
return "sub bar";
}
package main;
my $self = Foo->new;
print $self->bar;
raises a complaint like:
"You are overwriting a locally defined method (bar) with an accessor at ..."
Shouldn't the role behavior follow the class behavior rather than
silently ignoring an accessor overwrtiting a method?