Explained in
Method Conflicts
and in the following section "Method Exclusion and aliasing".
package top;
use Moose::Role;
requires 'token';
sub foo {
print "foo\n";
}
package bottom;
use Moose::Role;
with 'top' => {
-alias =>{ foo => '_foo', },
-excludes => [ 'foo' ],
};
sub foo {
print "bar\n";
}
package something;
use Moose;
with "bottom";
sub token {
print "I don't want to implement token untill the concerete class
+but I want to use bottom's version of foo\n";
}
package main;
my $something = new something;
$something->foo;