version 1.33, 2003/03/25 03:00:31
|
version 1.34, 2003/03/28 23:32:46
|
Line 47 sub evaluate {
|
Line 47 sub evaluate {
|
$Apache::run::timeout=1; |
$Apache::run::timeout=1; |
die("timeout"); |
die("timeout"); |
}; |
}; |
|
my $innererror; |
eval { |
eval { |
alarm(Apache->request->server->timeout); |
alarm(Apache->request->server->timeout); |
$safeeval->reval('{'.$decls.';$_=<<\'EXPRESSION\';'."\n".$expression. |
$safeeval->reval('{'.$decls.';$_=<<\'EXPRESSION\';'."\n".$expression. |
"\n".'EXPRESSION'."\n".$EVALUATE_STRING.'}'); |
"\n".'EXPRESSION'."\n".$EVALUATE_STRING.'}'); |
|
$innererror=$@; |
alarm(0); |
alarm(0); |
}; |
}; |
my $error=$@; |
my $error=$@; |
if ($error eq '' && !$Apache::run::timeout) { |
if ($error eq '' && $innererror eq '' && !$Apache::run::timeout) { |
$result = $safeeval->reval('return $_;'); |
$result = $safeeval->reval('return $_;'); |
chomp $result; |
chomp $result; |
} else { |
} else { |
Line 62 sub evaluate {
|
Line 64 sub evaluate {
|
$error = 'Code ran too long. It ran for more than '. |
$error = 'Code ran too long. It ran for more than '. |
Apache->request->server->timeout.' seconds'; |
Apache->request->server->timeout.' seconds'; |
} |
} |
&Apache::lonxml::error('substitution on <pre>'.$expression. |
&Apache::lonxml::error('substitution on <pre>'. |
'</pre> with <pre>'.$decls. |
&HTML::Entities::encode($expression). |
'</pre> caused <pre>'.$error); |
'</pre> with <pre>'. |
|
&HTML::Entities::encode($decls). |
|
'</pre> caused <pre>'. |
|
&HTML::Entities::encode($error).' '. |
|
&HTML::Entities::encode($innererror). |
|
'</pre>'); |
} |
} |
return $result |
return $result |
} |
} |
Line 78 sub run {
|
Line 85 sub run {
|
$Apache::run::timeout=1; |
$Apache::run::timeout=1; |
die("timeout"); |
die("timeout"); |
}; |
}; |
|
my $innererror; |
eval { |
eval { |
alarm(Apache->request->server->timeout); |
alarm(Apache->request->server->timeout); |
@result=$safeeval->reval($code); |
@result=$safeeval->reval($code); |
|
$innererror=$@; |
alarm(0); |
alarm(0); |
}; |
}; |
my $error=$@; |
my $error=$@; |
if (($Apache::run::timeout || $error ne '') && !$hideerrors) { |
&Apache::lonxml::debug("run got $@"); |
|
if (($Apache::run::timeout || $error ne '' || $innererror ne '') && !$hideerrors) { |
if ($Apache::run::timeout) { |
if ($Apache::run::timeout) { |
$error = 'Code ran too long. It ran for more than '. |
$error = 'Code ran too long. It ran for more than '. |
Apache->request->server->timeout.' seconds'; |
Apache->request->server->timeout.' seconds'; |
} |
} |
&Apache::lonxml::error('<pre>'.&HTML::Entities::encode($error). |
&Apache::lonxml::error('<pre>'.&HTML::Entities::encode($error).' '. |
|
&HTML::Entities::encode($innererror). |
'</pre> occured while running <pre>'. |
'</pre> occured while running <pre>'. |
&HTML::Entities::encode($code).'</pre>'); |
&HTML::Entities::encode($code).'</pre>'); |
} |
} |