Diff for /loncom/xml/run.pm between versions 1.48 and 1.55

version 1.48, 2004/07/19 16:53:46 version 1.55, 2006/01/11 08:52:58
Line 48  while (!$_LONCAPA_INTERNAL_oldexpression Line 48  while (!$_LONCAPA_INTERNAL_oldexpression
                 (?=[^\[\{\(]|$)/                  (?=[^\[\{\(]|$)/
  my ($__LC__a,$__LC__b,$__LC__c)=($1,$2,$3);   my ($__LC__a,$__LC__b,$__LC__c)=($1,$2,$3);
  my $__LC__prefix;   my $__LC__prefix;
  my $result;   my $__LC__result;
  while (1) {   while (1) {
        if ($__LC__a =~ m-^&(theta|i|pi|rho)-) { last; }
      {        { 
  use strict;   use strict;
  no strict "vars";   no strict "vars";
  if (eval(defined(eval($__LC__a.$__LC__b)))) {   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;       last;
  }   }
      }       }
      $__LC__prefix.=substr($__LC__a,0,1,"");       $__LC__prefix.=substr($__LC__a,0,1,"");
      if ($__LC__a!~m-^(\$|&|\#)-) { last; }       if ($__LC__a!~m-^(\$|&|\#)-) { last; }
  }   }
  if (!defined($result)) {   if (!defined($__LC__result)) {
      $result=$__LC__prefix.$__LC__a.$__LC__b.$__LC__c;       $__LC__result=$__LC__prefix.$__LC__a.$__LC__b.$__LC__c;
  }   }
  $result;   $__LC__result;
                   /sexg;                    /sexg;
     if (scalar(values(%_LONCAPA_INTERNAL_oldexpressions))>10) {last;}      if (scalar(values(%_LONCAPA_INTERNAL_oldexpressions))>10) {last;}
 }  }
Line 83  sub evaluate { Line 84  sub evaluate {
     };      };
     my $innererror;      my $innererror;
     eval {      eval {
  alarm($Apache::lonnet::perlvar{'lonScriptTimeout'});   &Apache::lonxml::start_alarm();
  $safeeval->reval('{'.$decls.';$_=<<\'EXPRESSION\';'."\n".$expression.   $safeeval->reval('{'.$decls.';$_=<<\'EXPRESSION\';'."\n".$expression.
  "\n".'EXPRESSION'."\n".$EVALUATE_STRING.'}');   "\n".'EXPRESSION'."\n".$EVALUATE_STRING.'}');
  $innererror=$@;   $innererror=$@;
  alarm(0);   &Apache::lonxml::end_alarm();
     };      };
     my $error=$@;      my $error=$@; 
     if ($error eq '' && $innererror eq '' && !$Apache::run::timeout) {      if ($error eq '' && $innererror eq '' && !$Apache::run::timeout) {
  $result = $safeeval->reval('return $_;');   $result = $safeeval->reval('return $_;');
  chomp $result;   chomp $result;
Line 121  sub run { Line 122  sub run {
     };      };
     my $innererror;      my $innererror;
     eval {      eval {
  alarm($Apache::lonnet::perlvar{'lonScriptTimeout'});   &Apache::lonxml::start_alarm();
  @result=$safeeval->reval($code);   @result=$safeeval->reval($code);
  $innererror=$@;   $innererror=$@;
  alarm(0);   &Apache::lonxml::end_alarm();
     };      };
     my $error=$@;      my $error=$@;
     if (($Apache::run::timeout || $error ne '' || $innererror ne '') && !$hideerrors) {      if (($Apache::run::timeout || $error ne '' || $innererror ne '') && !$hideerrors) {
Line 157  sub dump { Line 158  sub dump {
     my ($target,$safeeval)=@_;      my ($target,$safeeval)=@_;
     my $dump='';      my $dump='';
     foreach my $symname (sort keys %{$safeeval->varglob('main::')}) {      foreach my $symname (sort keys %{$safeeval->varglob('main::')}) {
  if (($symname!~/^\_/) && ($symname!~/\:$/)) {   if (($symname!~ /^(INC|SIG)/) && ($symname!~/\027/) &&
       ($symname!~/^\_/) && ($symname!~/\:$/)) {
     my $line;      my $line;
     if ($safeeval->reval('defined($'.$symname.')')) {      if ($safeeval->reval('defined($'.$symname.')')) {
  $line='$'.$symname.'='.$safeeval->reval('$'.$symname);   if ($symname =~ /^\w/) {
       $line.='$'.$symname.'='.$safeeval->reval('$'.$symname)."\n";
    }
     }      }
     if ($safeeval->reval('defined(@'.$symname.')')) {      if ($safeeval->reval('defined(@'.$symname.')')) {
  $line='@'.$symname.'=('.   $line.='@'.$symname.'=('.
     $safeeval->reval('join(",",@'.$symname.')').")";      $safeeval->reval('join(",",@'.$symname.')').")"."\n";
     }      }
     if ($safeeval->reval('defined(%'.$symname.')')) {      if ($safeeval->reval('defined(%'.$symname.')')) {
  $line='%'.$symname.'=(';   $line.='%'.$symname.'=(';
  $line.=$safeeval->reval('join(",",map { $_."=>".$'.   $line.=$safeeval->reval('join(",",map { $_."=>".$'.
  $symname.'{$_} } sort keys %'.   $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 />|g;
    $dump.=$line;
       }
  }   }
     }      }
     $dump.='';      $dump.='';

Removed from v.1.48  
changed lines
  Added in v.1.55


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