Created
March 10, 2012 14:58
-
-
Save tadzik/2011660 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
role MyRole { | |
has $!a; | |
method !getter { $!a } | |
method new($arg) { | |
self.bless(*, :a($arg)) | |
} | |
submethod BUILD (:$!a) { } | |
} | |
class MyClass does MyRole { | |
method accessor { self!getter } | |
} | |
say MyClass.new(3).accessor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment