I would like to overload some methods in Moops.
I have the tried the following code:
method setIdNum() {
print "Please enter ID number: ";
chomp (my $input = <STDIN>);
$self->$idNum($input);
}
method setIdNum(Int $num) {
$self->$idNum($num);
}
But it errors by saying setIdNum is redefined.
If you want multimethods, you have to ask for them explicitly by putting
multi
in front of themethod
keyword:You may also need to explicitly ask for Kavorka support inside your class declaration: