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

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 16 Aug 2002 18:25:24 -0000


matthew		Fri Aug 16 14:25:24 2002 EDT

  Modified files:              
    /loncom/interface	lonspreadsheet.pm 
  Log:
  Fix dumb error - if a requested parameter name matched more than one parameter,
  we should return one that matches exactly the requested parameter name.
  
  
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.99 loncom/interface/lonspreadsheet.pm:1.100
--- loncom/interface/lonspreadsheet.pm:1.99	Mon Aug 12 14:21:42 2002
+++ loncom/interface/lonspreadsheet.pm	Fri Aug 16 14:25:24 2002
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.99 2002/08/12 18:21:42 albertel Exp $
+# $Id: lonspreadsheet.pm,v 1.100 2002/08/16 18:25:24 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -768,6 +768,14 @@
         }
         if ($#matches == 0) {
             $returnvalue = '$c{\''.$matches[0].'\'}';
+        } elsif ($#matches > 0) {
+            # more than one match.  Look for a concise one
+            $returnvalue =  "'non-unique parameter name : $expression'";
+            foreach (@matches) {
+                if (/^$expression$/) {
+                    $returnvalue = '$c{\''.$_.'\'}';
+                }
+            }
         } else {
             $returnvalue =  "'bad parameter name : $expression'";
         }