Diff for /loncom/interface/spreadsheet/Spreadsheet.pm between versions 1.13 and 1.14

version 1.13, 2003/06/18 15:32:37 version 1.14, 2003/06/18 17:35:14
Line 816  sub expandnamed { Line 816  sub expandnamed {
         #    4. If there is a collision, return 'bad parameter name error'          #    4. If there is a collision, return 'bad parameter name error'
         my $returnvalue = '';          my $returnvalue = '';
         my @matches = ();          my @matches = ();
           my @values = ();
         $#matches = -1;          $#matches = -1;
         study $expression;          study $expression;
         my $parameter;          while (my($parameter,$value) = each(%{$self->{'constants'}})) {
         foreach $parameter (keys(%{$self->{'constants'}})) {              next if ($parameter !~ /$expression/);
             push @matches,$parameter if ($parameter =~ /$expression/);              push(@matches,$parameter);
               push(@values,$value);
         }          }
         if (scalar(@matches) == 0) {          if (scalar(@matches) == 0) {
             $returnvalue = '""';#'"unmatched parameter: '.$parameter.'"';              $returnvalue = '""';#'"unmatched parameter: '.$parameter.'"';
         } elsif (scalar(@matches) == 1) {          } elsif (scalar(@matches) == 1) {
             # why do we not do this lookup here, instead of delaying it?              # why do we not do this lookup here, instead of delaying it?
             $returnvalue = '$c{\''.$matches[0].'\'}';              $returnvalue = $values[0];
         } elsif (scalar(@matches) > 0) {          } elsif (scalar(@matches) > 0) {
             # more than one match.  Look for a concise one              # more than one match.  Look for a concise one
             $returnvalue =  "'non-unique parameter name : $expression'";              $returnvalue =  "'non-unique parameter name : $expression'";
             foreach (@matches) {              for (my $i=0; $i<=$#matches;$i++) {
                 if (/^$expression$/) {                  if ($matches[$i] =~ /^$expression$/) {
                     # why do we not do this lookup here?                      # why do we not do this lookup here?
                     $returnvalue = '$c{\''.$_.'\'}';                      $returnvalue = $values[$i];
                 }                  }
             }              }
         } else {          } else {
             # There was a negative number of matches, which indicates               # There was a negative number of matches, which indicates 
             # something is wrong with reality.  Better warn the user.              # something is wrong with reality.  Better warn the user.
             $returnvalue = '"bizzare parameter: '.$parameter.'"';              $returnvalue = '"bizzare parameter: '.$expression.'"';
         }          }
         return $returnvalue;          return $returnvalue;
     }      }

Removed from v.1.13  
changed lines
  Added in v.1.14


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>