--- loncom/xml/run.pm 2005/10/04 16:30:23 1.52
+++ loncom/xml/run.pm 2006/03/16 15:47:37 1.58
@@ -1,6 +1,6 @@
package Apache::run;
#
-# $Id: run.pm,v 1.52 2005/10/04 16:30:23 albertel Exp $
+# $Id: run.pm,v 1.58 2006/03/16 15:47:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -50,6 +50,7 @@ while (!$_LONCAPA_INTERNAL_oldexpression
my $__LC__prefix;
my $__LC__result;
while (1) {
+ if ($__LC__a =~ m-^&(theta|pi|rho)$-) { last; }
{
use strict;
no strict "vars";
@@ -77,7 +78,7 @@ sub evaluate {
my $result = '';
$@='';
$Apache::run::timeout=0;
- $main::SIG{'ALRM'} = sub {
+ local $main::SIG{'ALRM'} = sub {
$Apache::run::timeout=1;
die("timeout");
};
@@ -115,7 +116,7 @@ sub run {
my @result;
$@='';
$Apache::run::timeout=0;
- $main::SIG{'ALRM'} = sub {
+ local $main::SIG{'ALRM'} = sub {
$Apache::run::timeout=1;
die("timeout");
};
@@ -139,8 +140,10 @@ sub run {
if ($innererror=~/line (\d+)/) {
my $linenumber=$1;
my @code=split("\n",$code);
- $code[$linenumber-1]=''.
- $code[$linenumber-1].'';
+ if ($linenumber < scalar(@code)) {
+ $code[$linenumber-1]=''.
+ $code[$linenumber-1].'';
+ }
$code=join("\n",@code);
}
&Apache::lonxml::error($errormsg.$code.'');
@@ -157,7 +160,8 @@ sub dump {
my ($target,$safeeval)=@_;
my $dump='';
foreach my $symname (sort keys %{$safeeval->varglob('main::')}) {
- if (($symname!~/^\_/) && ($symname!~/\:$/)) {
+ if (($symname!~ /^(INC|SIG)/) && ($symname!~/\027/) &&
+ ($symname!~/^\_/) && ($symname!~/\:$/)) {
my $line;
if ($safeeval->reval('defined($'.$symname.')')) {
if ($symname =~ /^\w/) {
@@ -172,8 +176,8 @@ sub dump {
$line.='%'.$symname.'=(';
$line.=$safeeval->reval('join(",",map { $_."=>".$'.
$symname.'{$_} } sort keys %'.
- $symname.')').")"."\n"
- }
+ $symname.')').")"."\n";
+ }
if ($line ne '') {
$line=&HTML::Entities::encode($line,'<>&"');
$line=~s|\n|
|g;