Created
October 8, 2013 12:51
-
-
Save domm/6884191 to your computer and use it in GitHub Desktop.
mop add method
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
use 5.18.1; | |
use mop; | |
class Foo {}; | |
mop::meta('Foo')->add_method(mop::method->new(name=>'bar',body=>sub { say "bar"})); | |
my $foo = Foo->new; | |
$foo->bar; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mop::meta('Foo')->FINALIZE before object creation will confirm the method meta addition