diff --git a/macros/parsers/parserMultiAnswer.pl b/macros/parsers/parserMultiAnswer.pl index ca3317e05..6499f5f72 100644 --- a/macros/parsers/parserMultiAnswer.pl +++ b/macros/parsers/parserMultiAnswer.pl @@ -62,6 +62,7 @@ sub new { part => 0, singleResult => 0, namedRules => 0, + cmpOpts => undef, checkTypes => 1, allowBlankAnswers => 0, tex_separator => $separator . '\,', @@ -89,8 +90,10 @@ sub setCmpFlags { # the individual answer checkers. # sub cmp { - my $self = shift; - my %options = @_; + my ($self, %options) = @_; + + %options = (%options, %{ $self->{cmpOpts} }) if ref($self->{cmpOpts}) eq 'HASH'; + foreach my $id ('checker', 'separator') { if (defined($options{$id})) { $self->{$id} = $options{$id}; @@ -488,6 +491,13 @@ =head2 namedRules if you need to intersperse other rules with the ones for the C. In this case, you must use C instead of C. Default: 0. +=head2 cmpOpts + +This is a hash of options that will be passed to the cmp method of all answers. For example, +C<< cmpOpts => { weight => 0.5 } >>. This option is provided to make it more convenient to pass +options to all answers when utilizing PGML. To pass options to a single answer, use the +C<< setCmpFlags($which_rule, %flags) >> method instead. Default: undef (no options are sent). + =head2 checkTypes Specifies whether the types of the student and professor's answers must match exactly