| … | |
… | |
| 486 | |
486 | |
| 487 | sub get_student_answer { |
487 | sub get_student_answer { |
| 488 | my $self = shift; |
488 | my $self = shift; |
| 489 | my $input = shift; |
489 | my $input = shift; |
| 490 | my %answer_options = @_; |
490 | my %answer_options = @_; |
| 491 | my $display_input = $input; |
491 | my $display_input = $input; |
| 492 | $display_input =~ s/\0/\\0/g; # make null spacings visible |
492 | $display_input =~ s/\0/\\0/g; # make null spacings visible |
| 493 | warn "Raw student answer is |$display_input|" if $self->{debug}; |
493 | warn "Raw student answer is |$display_input|" if $self->{debug}; |
| 494 | $input = '' unless defined($input); |
494 | $input = '' unless defined($input); |
| 495 | if (ref($input) =~/AnswerHash/) { |
495 | if (ref($input) =~/AnswerHash/) { |
| 496 | # in this case nothing needs to be done, since the student's answer is already in an answerhash. |
496 | # in this case nothing needs to be done, since the student's answer is already in an answerhash. |
| … | |
… | |
| 525 | sub evaluate { |
525 | sub evaluate { |
| 526 | my $self = shift; |
526 | my $self = shift; |
| 527 | $self->get_student_answer(@_); |
527 | $self->get_student_answer(@_); |
| 528 | $self->{rh_ans}->{error_flag}=undef; #reset the error flags in case |
528 | $self->{rh_ans}->{error_flag}=undef; #reset the error flags in case |
| 529 | $self->{rh_ans}->{done}=undef; #the answer evaluator is called twice |
529 | $self->{rh_ans}->{done}=undef; #the answer evaluator is called twice |
| 530 | my $rh_ans = $self ->{rh_ans}; |
530 | my $rh_ans = $self ->{rh_ans}; |
| 531 | warn "<H3> Answer evaluator information: </H3>\n" if defined($self->{debug}) and $self->{debug}>0; |
531 | warn "<H3> Answer evaluator information: </H3>\n" if defined($self->{debug}) and $self->{debug}>0; |
| 532 | my @prefilters = @{$self -> {pre_filters}}; |
532 | my @prefilters = @{$self -> {pre_filters}}; |
| 533 | my $count = -1; # the blank filter is counted as filter 0 |
533 | my $count = -1; # the blank filter is counted as filter 0 |
| 534 | foreach my $i (@prefilters) { |
534 | foreach my $i (@prefilters) { |
| 535 | last if defined( $self->{rh_ans}->{error_flag} ); |
535 | last if defined( $self->{rh_ans}->{error_flag} ); |