Created
May 30, 2012 02:16
-
-
Save sng2c/2832869 to your computer and use it in GitHub Desktop.
moose monkey patch
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 Dog; | |
#use Any::Moose; | |
use Moose; | |
sub bark{ | |
my $self = shift; | |
print $self->word() x 2; | |
print "\n"; | |
} | |
sub word{ | |
return "멍"; | |
} | |
package main; | |
my $meta = Dog->meta; | |
$meta->add_override_method_modifier('word',sub{return '냐옹'}); | |
my $d = Dog->new(); | |
$d->bark(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment