Subject: | composing attribute and method with the same name: not an error |
package Dog;
use Moose::Role;
has('name', isa => 'Str', is => 'ro', default => 'Fido');
sub bark {
my ($self, $noise) = @_;
$noise //= 'bowwow';
return "$noise!";
}
package Tree;
use Moose::Role;
use Moose::Util::TypeConstraints 'enum';
enum 'bark_t', [qw(rough smooth peeling)];
has('bark', isa => 'bark_t', is => 'ro', default => 'peeling');
package Farm;
use Moose;
with 'Tree', 'Dog';
package main;
use 5.010;
say Farm->new->bark; # got: peeling, expect: composition error