--- loncom/homework/default_homework.lcpm 2005/09/26 21:39:53 1.103 +++ loncom/homework/default_homework.lcpm 2005/11/16 22:18:22 1.104 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run() # -# $Id: default_homework.lcpm,v 1.103 2005/09/26 21:39:53 albertel Exp $ +# $Id: default_homework.lcpm,v 1.104 2005/11/16 22:18:22 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -193,7 +193,7 @@ sub caparesponse_check_list { my $type = $LONCAPA::CAPAresponse_args{'type'}; $result.="Got type :$type:\n"; if ($type ne '' && $#list > 0) { - (@responselist)=split /,/,$response; + (@responselist)=split(/,/,$response); } else { (@responselist)=($response); } @@ -217,18 +217,23 @@ sub caparesponse_check_list { $result.="trying answer :$list[$i]:\n"; my $thisanswer=$list[$i]; $result.="trying answer :$thisanswer:\n"; - if ($unit eq '') { - ($aresult,$msg)=&caparesponse_check($thisanswer,$responselist[$i]); + if (defined($list[$i])) { + if ($unit eq '') { + ($aresult,$msg)=&caparesponse_check($thisanswer, + $responselist[$i]); + } else { + ($aresult,$msg)=&caparesponse_check($thisanswer, + $responselist[$i]." $unit"); + } } else { - ($aresult,$msg)=&caparesponse_check($thisanswer, - $responselist[$i]." $unit"); + $aresult='ERROR'; } - my ($temp)=split /:/, $aresult; + my ($temp)=split(/:/, $aresult); $awards.="$temp,"; $result.=$aresult; push(@msgs,$msg); } - chop $awards; + chop($awards); return ("$awards:\n$result",@msgs); }