From: Sam H. v. a. <we...@ma...> - 2005-10-02 18:09:31
|
Log Message: ----------- fix error reporting for include() function. Modified Files: -------------- webwork2/lib/WeBWorK: CourseEnvironment.pm Revision Data ------------- Index: CourseEnvironment.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/CourseEnvironment.pm,v retrieving revision 1.26 retrieving revision 1.27 diff -Llib/WeBWorK/CourseEnvironment.pm -Llib/WeBWorK/CourseEnvironment.pm -u -r1.26 -r1.27 --- lib/WeBWorK/CourseEnvironment.pm +++ lib/WeBWorK/CourseEnvironment.pm @@ -84,15 +84,13 @@ die "Included file $file has potentially insecure path: contains \"..\""; } else { local @INC = (); - unless (my $result = do $fullPath) { - # FIXME: "do" is misbehaving: if there's a syntax error, $@ - # should be set to the error string, but it's not getting set. - # $! is set to an odd error message "Broken pipe" or something. - # On the command line, both $! and $@ are set in the case of a - # syntax error. This just means that errors will be confusing. - $! and die "Failed to read include file $fullPath: $! (has it been created from the corresponding .dist file?)"; - $@ and die "Failed to compile include file $fullPath: $@"; - die "Include file $fullPath did not return a true value."; + my $result = do $fullPath; + if ($!) { + warn "Failed to read include file $fullPath (has it been created from the corresponding .dist file?): $!"; + } elsif ($@) { + warn "Failed to compile include file $fullPath: $@"; + } elsif (not $result) { + warn "Include file $fullPath did not return a true value."; } } } ]; @@ -102,7 +100,7 @@ $safe->reval($include); $@ and die "Failed to reval include subroutine: $@"; $safe->mask($maskBackup); - + # determine location of globalEnvironmentFile my $globalEnvironmentFile = "$seedVars{webwork_dir}/conf/global.conf"; |