Created
July 1, 2012 15:33
-
-
Save ynonp/3028758 to your computer and use it in GitHub Desktop.
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
package Pet; | |
use Moose; | |
has 'name', is => 'ro', isa => 'Str', default => 'Nemo'; | |
has 'past_owners', is => 'ro', isa => 'ArrayRef[Str]'; | |
package main; | |
my $dog = Pet->new( past_owners => ['James', 'Mike'] ); | |
# show dog's info. No need to import Data::Dumper | |
warn $dog->dump; | |
# DOES returns true for objects of the class, subclasses or | |
# implementors of the role | |
print "Good boy" if $dog->DOES('Pet'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment