Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@MattOates
Last active December 24, 2015 05:39
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 MattOates/dd32fb60f5d1e9e2eb64 to your computer and use it in GitHub Desktop.
Save MattOates/dd32fb60f5d1e9e2eb64 to your computer and use it in GitHub Desktop.
Playing with delegation in perl6
#!/usr/bin/env perl6
use v6;
class Mouth {
has @.vocab;
method speak {
say @!vocab.pick;
}
}
class Cat {
has $!mouth handles :meow<speak> = Mouth.new(vocab => <ROAR! meow>);
}
my $test = Cat.new;
$test.meow;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment