--- loncom/homework/default_homework.lcpm 2001/06/14 21:29:14 1.28 +++ loncom/homework/default_homework.lcpm 2001/07/13 14:49:28 1.30 @@ -21,12 +21,12 @@ sub caparesponse_check { my $sig_lbound=''; #done my $sig_ubound=''; #done my $ans_fmt=''; - my $units=''; #done + my $unit=''; #done my $calc=''; my ($response,$expr)=@_; ($answer,$type,$tol,$sig,$ans_fmt, - $units,$calc) = eval $expr.';return $answer,$type,$tol,$sig,$ans_fmt,$units,$calc'; + $unit,$calc) = eval $expr.';return $answer,$type,$tol,$sig,$ans_fmt,$unit,$calc'; #type's definitons come from capaParser.h if ($type eq '' ) { if ( $answer eq ($answer *1.0)) { $type = 2; @@ -61,7 +61,7 @@ sub caparesponse_check { my $result = &caparesponse_capa_check_answer($response,$answer,$type, $tol_type,$tol, $sig_lbound,$sig_ubound, - $ans_fmt,$units,$calc); + $ans_fmt,$unit,$calc); if ($result == '1') { $result='EXACT_ANS'; } elsif ($result == '2') { $result='APPROX_ANS'; } @@ -82,11 +82,13 @@ sub caparesponse_check { sub caparesponse_check_list { my ($response,$expr)=@_; + # do these first, because who knows what varname the instructor might have used + # but it probably isn't $CAPARESPONSE_CHECK_LIST_answer + my $CAPARESPONSE_CHECK_LIST_answer = eval $expr.';return $answer'; + my (@list) = eval $CAPARESPONSE_CHECK_LIST_answer; my $result=''; my $aresult=''; my $current_answer; - my $answer = eval $expr.';return $answer'; - my (@list) = eval $answer; my (@responselist)=split /,/,$response; my $unit=''; $result.="Final response :$responselist['-1']:
";