[LON-CAPA-cvs] cvs: loncom /interface lonspreadsheet.pm

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 25 Oct 2002 19:47:14 -0000


matthew		Fri Oct 25 15:47:14 2002 EDT

  Modified files:              
    /loncom/interface	lonspreadsheet.pm 
  Log:
  Reinstated warning user of bad parameters.
  
  
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.128 loncom/interface/lonspreadsheet.pm:1.129
--- loncom/interface/lonspreadsheet.pm:1.128	Fri Oct 25 11:58:35 2002
+++ loncom/interface/lonspreadsheet.pm	Fri Oct 25 15:47:14 2002
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.128 2002/10/25 15:58:35 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.129 2002/10/25 19:47:14 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -828,8 +828,8 @@
         foreach $parameter (keys(%c)) {
             push @matches,$parameter if ($parameter =~ /$expression/);
         }
-        if (scalar(@matches )== 0) {
-            return;
+        if (scalar(@matches) == 0) {
+            $returnvalue = 'unmatched parameter: '.$parameter;
         } elsif (scalar(@matches) == 1) {
             $returnvalue = '$c{\''.$matches[0].'\'}';
         } elsif (scalar(@matches) > 0) {
@@ -840,6 +840,10 @@
                     $returnvalue = '$c{\''.$_.'\'}';
                 }
             }
+        } else {
+            # There was a negative number of matches, which indicates 
+            # something is wrong with reality.  Better warn the user.
+            $returnvalue = 'bizzare parameter: '.$parameter;
         }
         return $returnvalue;
     }
@@ -946,8 +950,7 @@
 }
 
 #
-# This is actually used for the student spreadsheet, not the assessment sheet
-# Do not be fooled by the name!
+#
 #
 sub templaterow {
     my $sheet = shift;