The problem is that you are not passing the subroutine as the checker, but the
return value of the subroutine when called as
override()
. You need to do either
sub override {return 1}
ANS($val->cmp(checker => ~~&override ));
or
$override = sub {return 1};
ANS($val->cmp(checker => $override ));
or
ANS($val->cmp(checker => sub {
return 1;
} ));
Many people prefer the latter if they are only using the custom checker once, otherwise, the middle one is good if you are defining the subroutine in a macro file.