Created
February 3, 2014 14:36
-
-
Save sschober/8784886 to your computer and use it in GitHub Desktop.
RoleA requiring method provided by RoleB - Moo-Version (works)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Moops; | |
role RoleA { | |
requires 'm1'; | |
method m2() { | |
$self->m1." World!\n"; | |
} | |
} | |
role RoleB { | |
has 'm1' => ( is => 'ro', isa => 'Str', default => 'Hello'); | |
} | |
class ClassA | |
with RoleB | |
with RoleA { | |
method m3() { | |
$self->m2(); | |
} | |
} | |
print ClassA->new()->m3(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment