Last active
December 18, 2017 10:14
-
-
Save andrewsolomon/b0aacbd7f7916ec0ce5dd1028479edb8 to your computer and use it in GitHub Desktop.
This file contains 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
{ | |
package Brand; | |
use Moo::Role; | |
has name => ( is => 'rw', required => 1 ); # made rw | |
sub description { "This is a nice ". shift->name } | |
} | |
{ | |
package Car; | |
use Moo; | |
# with 'Brand'; # not at compile time | |
} | |
my $car = Car->new; | |
# TODO an investigation which determines that it really is a branded car | |
Moo::Role->apply_roles_to_object($car, 'Brand'); | |
# $car->name("Peugeot"); | |
say $car->description; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment