| … | |
… | |
| 39 | |
39 | |
| 40 | # read and evaluate the course environment file |
40 | # read and evaluate the course environment file |
| 41 | # if readFile failed, we don't bother trying to reval |
41 | # if readFile failed, we don't bother trying to reval |
| 42 | my $courseFileContents = eval { readFile($courseEnvironmentFile) }; # catch exceptions |
42 | my $courseFileContents = eval { readFile($courseEnvironmentFile) }; # catch exceptions |
| 43 | $@ or $safe->reval($courseFileContents); |
43 | $@ or $safe->reval($courseFileContents); |
| 44 | $@ = ""; |
|
|
| 45 | |
44 | |
| 46 | # get the safe compartment's namespace as a hash |
45 | # get the safe compartment's namespace as a hash |
| 47 | no strict 'refs'; |
46 | no strict 'refs'; |
| 48 | my %symbolHash = %{$safe->root."::"}; |
47 | my %symbolHash = %{$safe->root."::"}; |
| 49 | use strict 'refs'; |
48 | use strict 'refs'; |
| … | |
… | |
| 113 | # ----- utils ----- |
112 | # ----- utils ----- |
| 114 | |
113 | |
| 115 | sub readFile { |
114 | sub readFile { |
| 116 | my $fileName = shift; |
115 | my $fileName = shift; |
| 117 | open INPUTFILE, "<", $fileName |
116 | open INPUTFILE, "<", $fileName |
| 118 | or die "Couldn't open environment file $fileName: $!"; |
117 | ;#or die "Couldn't open environment file $fileName: $!"; |
| 119 | my $result = join "\n", <INPUTFILE>; |
118 | my $result = join "\n", <INPUTFILE>; |
| 120 | close INPUTFILE; |
119 | close INPUTFILE; |
| 121 | return $result; |
120 | return $result; |
| 122 | } |
121 | } |
| 123 | |
122 | |