--- loncom/xml/run.pm 2003/06/18 21:04:42 1.39 +++ loncom/xml/run.pm 2003/11/09 01:17:35 1.42 @@ -1,6 +1,6 @@ package Apache::run; # -# $Id: run.pm,v 1.39 2003/06/18 21:04:42 albertel Exp $ +# $Id: run.pm,v 1.42 2003/11/09 01:17:35 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -98,10 +98,18 @@ sub run { $error = 'Code ran too long. It ran for more than '. Apache->request->server->timeout.' seconds'; } - &Apache::lonxml::error('
'.&HTML::Entities::encode($error).' '. - &HTML::Entities::encode($innererror). - 'occured while running
'. - &HTML::Entities::encode($code).''); + my $errormsg='
'.&HTML::Entities::encode($error).' '. + &HTML::Entities::encode($innererror). + 'occured while running
'; + $code=&HTML::Entities::encode($code); + if ($innererror=~/line (\d+)/) { + my $linenumber=$1; + my @code=split("\n",$code); + $code[$linenumber-1]=''. + $code[$linenumber-1].''; + $code=join("\n",@code); + } + &Apache::lonxml::error($errormsg.$code.''); } if ( $#result < '1') { return $result[0]; @@ -112,29 +120,29 @@ sub run { } sub dump { - my ($target,$safeeval)=@_; - my $dump=''; - foreach my $symname (sort keys %{$safeeval->varglob('main::')}) { - if (($symname!~/^\_/) && ($symname!~/\:$/)) { - my $line; - if ($safeeval->reval('defined($'.$symname.')')) { - $line='$'.$symname.'='.$safeeval->reval('$'.$symname); - } - if ($safeeval->reval('defined(@'.$symname.')')) { - $line='@'.$symname.'=('. - $safeeval->reval('join(",",@'.$symname.')').")"; - } - if ($safeeval->reval('defined(%'.$symname.')')) { - $line='%'.$symname.'=('; - $line.=$safeeval->reval('join(",",map { $_."=>".$'. - $symname.'{$_} } sort keys %'. - $symname.')').")" - } - if ($line ne '') { $dump.=&HTML::Entities::encode($line)."