From e34fb65a666c4a9b720ee53810378d7b5cff6c05 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 19 May 2026 11:19:45 -0500 Subject: [PATCH] Add a note in the `parserMultiAnswer.pl` macro about the `scores` array. This addes a comment to the POD about the `scores` array that is set internally, and that can be used in a custom checker. --- macros/parsers/parserMultiAnswer.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/macros/parsers/parserMultiAnswer.pl b/macros/parsers/parserMultiAnswer.pl index c8691e90a..3a79fdd47 100644 --- a/macros/parsers/parserMultiAnswer.pl +++ b/macros/parsers/parserMultiAnswer.pl @@ -515,16 +515,19 @@ =head2 checker # this checker will give full credit for any answers sub always_right { - my ($correct,$student,$multi_ans,$ans_hash) = @_; # get the parameters - return [ (1) x scalar(@$correct) ]; # return an array of scores + my ($correct, $student, $multi_ans, $ans_hash) = @_; # get the parameters + return [ (1) x scalar(@$correct) ]; # return an array of scores } - $multianswer_obj = $multianswer_obj->with(checker=>~~&always_right); + $multianswer_obj = $multianswer_obj->with(checker => ~~&always_right); If a C is not provided, a default checker is used. The default checker checks if each answer is equal to its correct answer (using the overloaded C<==> operator). If C<< partialCredit => 1 >>, the checker returns an array of 0s and 1s listing which answers are correct giving partial credit. If C<< partialCredit => 0 >>, the checker only returns 1 if all answers are correct, otherwise returns 0. +Note that C<< $multi_ans->{scores} >> will be set to a reference to an array containing the the +scores from evaluating the individual answers and can be used inside the C routine. + =head2 partialCredit This is used with the default checker to determine if the default checker should reward partial