Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created March 10, 2012 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadzik/2011660 to your computer and use it in GitHub Desktop.
Save tadzik/2011660 to your computer and use it in GitHub Desktop.
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