Subject: | Clarify relationship between aliasing and OOP |
Consider:
{
package Foo;
use Moose;
use MooseX::Aliases;
sub name { "foo" }
alias moniker => "name";
}
{
package Bar;
use Moose;
extends "Foo";
sub name { "bar" }
}
{
use Modern::Perl;
say Foo->new->moniker; # says "foo"
say Bar->new->moniker; # ???
}
Bar inherits "moniker" from Foo, but which version of the sub "name"
does Bar->new->moniker call?
And what about method modifiers...
{
package Foo;
use Moose;
use MooseX::Aliases;
sub name { "foo" }
alias moniker => "name";
around name => sub { warn "called name" };
}
{
use Modern::Perl;
say Foo->new->moniker; # does this warn?
}
I've tested these and the first example does say "bar", and the second
example does warn. But I shouldn't have needed to figure that out
through experimentation. The docs should tell me.