[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 16 Nov 2005 22:18:22 -0000
albertel Wed Nov 16 17:18:22 2005 EDT
Modified files:
/loncom/homework default_homework.lcpm
Log:
- some style
- mostyl try to protect againt sending undef as an 'answer' C code unhappy with that
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.103 loncom/homework/default_homework.lcpm:1.104
--- loncom/homework/default_homework.lcpm:1.103 Mon Sep 26 17:39:53 2005
+++ loncom/homework/default_homework.lcpm Wed Nov 16 17:18:22 2005
@@ -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 @@
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 @@
$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);
}