Thursday, May 7, 2009

Multiple colliding roles


role tree{
method bark(){...}
}

role dog{
method bark(){...}
}

class dog_tree does tree does dog{
method dog::bark(){ say "woof" }
method tree::bark(){ say "rough" }
}

sub pet_dog( my dog $dog ){
$dog.bark;
# actually calls
# $dog.meta.does(dog).bark
# $dog.dog::bark
# or something similar
}


No comments: