Subject: | Error when Role/Class attributes collide |
Date: | Sun, 6 Oct 2013 02:04:57 -0500 |
To: | bug-Moo [...] rt.cpan.org |
From: | Dylan Cali <calid1984 [...] gmail.com> |
Moo:
package FooRole;
use Moo::Role;
has quux => (
is => 'ro',
);
1;
package Bar;
use Moo;
with q(FooRole);
has quux => (
is => 'ro',
);
__PACKAGE__->meta->make_immutable();
package main;
my $b = Bar->new();
# error: You cannot overwrite a locally defined method (quux) with a
reader at /home/calid/perl5/lib/perl5/Method/Generate/Accessor.pm line 37.
Moose:
package FooRole;
use Moose::Role;
has quux => (
is => 'ro',
);
1;
package Bar;
use Moose;
with q(FooRole);
has quux => (
is => 'ro',
);
__PACKAGE__->meta->make_immutable();
package main;
my $b = Bar->new();
# noerror
Perl version: 5.18.1
Moo version: 1.003001