[system] / branches / rel-2-4-patches / pg / lib / Value / WeBWorK.pm Repository:
ViewVC logotype

Diff of /branches/rel-2-4-patches/pg/lib/Value/WeBWorK.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5928 Revision 5929
30 else {reportEvalError($@) unless $f->{context}{error}{flag}} 30 else {reportEvalError($@) unless $f->{context}{error}{flag}}
31 return $v; 31 return $v;
32} 32}
33 33
34# 34#
35# Call a subtroutine with error trapping.
36# (We need to be able to do this from custom
37# answer checkers and other MathObject code.
38# PG_restricted_eval is not sufficient for this
39# since that uses a string and so can't access
40# local variables from the calling routine.)
41#
42sub Eval {
43 my $f = shift;
44 return unless defined($f);
45 eval {&$f(@_)};
46}
47
48#
35# Remove backtrace and line number, since these 49# Remove backtrace and line number, since these
36# will be reported in the student message area. 50# will be reported in the student message area.
37# 51#
38sub Parser::reportEvalError { 52sub reportEvalError {
39 my $error = shift; my $fullerror = $error; 53 my $error = shift; my $fullerror = $error;
40 $error =~ s/ at \S+\.\S+ line \d+(\n|.)*//; 54 $error =~ s/ at \S+\.\S+ line \d+(\n|.)*//;
41 $error =~ s/ at line \d+ of (\n|.)*//; 55 $error =~ s/ at line \d+ of (\n|.)*//;
42 Value->context->setError($error); 56 Value->context->setError($error);
43 if (Value->context->{debug}) { 57 if (Value->context->{debug}) {

Legend:
Removed from v.5928  
changed lines
  Added in v.5929

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9