The attached file contains a custom answer checker. If I define the
sub in the .pg file by
$mycheckerref = sub { ... };
and call it with
ANS( $Soln->cmp( checker => $mycheckerref));
all is fine. I will use this checker in several problems, so I would
like to include it in a file of macros. I have tried several different
ways with no success.
1) just copy "$mycheckerref = sub { ... };" into the macro file, and
load the file.
2) define a named subroutine with "sub mychecker {...};" and call it with
ANS( $Soln->cmp( checker => mychecker));
or
ANS( $Soln->cmp( checker => &mychecker)); that's an ampersand
or
ANS( $Soln->cmp( checker => mychecker()));
In all these cases, the custom checker is ignored. Even if I define the
subroutine by name as in 2) within the original .pg file, it also is
ignored.
I even tried having the macro file return a reference to the
answerchecker. I assume its my syntax, but I don't know what else to try.
thanks again. I promise this will be the last question for a while.