Skip to content

Instantly share code, notes, and snippets.

@hoelzro
Created July 29, 2012 15:38
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 hoelzro/3199546 to your computer and use it in GitHub Desktop.
Save hoelzro/3199546 to your computer and use it in GitHub Desktop.
Using custom BUILD and Mu.BUILD in the same class
use v6;
class CustomObject {
}
class CustomBuild {
has $.foo;
has $.bar;
submethod BUILD(*%params) {
$!bar = CustomObject.new;
}
}
my $object = CustomBuild.new(:foo(17));
# $object.foo should be 17, right?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment