[LON-CAPA-cvs] cvs: loncom /xml run.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 10 Aug 2004 19:16:40 -0000


albertel		Tue Aug 10 15:16:40 2004 EDT

  Modified files:              
    /loncom/xml	run.pm 
  Log:
  - BUG#3283 was internally using $result when doing evaluates, 
  
  - also fixed the case where the script vars link failed to properly show when @var and $var and %var all had values
  
  
Index: loncom/xml/run.pm
diff -u loncom/xml/run.pm:1.48 loncom/xml/run.pm:1.49
--- loncom/xml/run.pm:1.48	Mon Jul 19 12:53:46 2004
+++ loncom/xml/run.pm	Tue Aug 10 15:16:40 2004
@@ -1,6 +1,6 @@
 package Apache::run;
 #
-# $Id: run.pm,v 1.48 2004/07/19 16:53:46 albertel Exp $
+# $Id: run.pm,v 1.49 2004/08/10 19:16:40 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -48,23 +48,23 @@
                 (?=[^\[\{\(]|$)/
 		 my ($__LC__a,$__LC__b,$__LC__c)=($1,$2,$3);
 		 my $__LC__prefix;
-		 my $result;
+		 my $__LC__result;
 		 while (1) {
 		     { 
 			 use strict;
 			 no strict "vars";
 			 if (eval(defined(eval($__LC__a.$__LC__b)))) {
-			     $result= $__LC__prefix.eval($__LC__a.$__LC__b.$__LC__c);
+			     $__LC__result= $__LC__prefix.eval($__LC__a.$__LC__b.$__LC__c);
 			     last;
 			 }
 		     }
 		     $__LC__prefix.=substr($__LC__a,0,1,"");
 		     if ($__LC__a!~m-^(\$|&|\#)-) { last; }
 		 }
-		 if (!defined($result)) {
-		     $result=$__LC__prefix.$__LC__a.$__LC__b.$__LC__c;
+		 if (!defined($__LC__result)) {
+		     $__LC__result=$__LC__prefix.$__LC__a.$__LC__b.$__LC__c;
 		 }
-		 $result;
+		 $__LC__result;
                   /sexg;
     if (scalar(values(%_LONCAPA_INTERNAL_oldexpressions))>10) {last;}
 }
@@ -160,19 +160,23 @@
 	if (($symname!~/^\_/) && ($symname!~/\:$/)) {
 	    my $line;
 	    if ($safeeval->reval('defined($'.$symname.')')) {
-		$line='$'.$symname.'='.$safeeval->reval('$'.$symname);
+		$line.='$'.$symname.'='.$safeeval->reval('$'.$symname)."\n";
 	    }	
 	    if ($safeeval->reval('defined(@'.$symname.')')) {
-		$line='@'.$symname.'=('.
-		    $safeeval->reval('join(",",@'.$symname.')').")";
+		$line.='@'.$symname.'=('.
+		    $safeeval->reval('join(",",@'.$symname.')').")"."\n";
 	    }
 	    if ($safeeval->reval('defined(%'.$symname.')')) {
-		$line='%'.$symname.'=(';
+		$line.='%'.$symname.'=(';
 		$line.=$safeeval->reval('join(",",map { $_."=>".$'.
 					$symname.'{$_} } sort keys %'.
-					$symname.')').")"
+					$symname.')').")"."\n"
 				    }
-	    if ($line ne '') {$dump.=&HTML::Entities::encode($line,'<>&"')."<br />";}
+	    if ($line ne '') {
+		$line=&HTML::Entities::encode($line,'<>&"');
+		$line=~s|\n|<br />|;
+		$dump.=$line;
+	    }
 	}
     }
     $dump.='';