| … | |
… | |
| 15 | use strict; |
15 | use strict; |
| 16 | use warnings; |
16 | use warnings; |
| 17 | use Safe; |
17 | use Safe; |
| 18 | use WeBWorK::Utils qw(readFile); |
18 | use WeBWorK::Utils qw(readFile); |
| 19 | |
19 | |
| 20 | # new($invocant, $webworkRoot, $courseName) |
20 | # new($invocant, $webworkRoot, $webworkURLRoot, $pgRoot, $courseName) |
| 21 | # $invocant implicitly set by caller |
21 | # $invocant implicitly set by caller |
| 22 | # $webworkRoot directory that contains the WeBWorK distribution |
22 | # $webworkRoot directory that contains the WeBWorK distribution |
| 23 | # $webworkURLRoot URL that points to the WeBWorK system |
23 | # $webworkURLRoot URL that points to the WeBWorK system |
|
|
24 | # $pgRoot directory that contains the PG distribution |
| 24 | # $courseName name of the course being used |
25 | # $courseName name of the course being used |
| 25 | sub new { |
26 | sub new { |
| 26 | my $invocant = shift; |
27 | my $invocant = shift; |
| 27 | my $class = ref($invocant) || $invocant; |
28 | my $class = ref($invocant) || $invocant; |
| 28 | my $webworkRoot = shift; |
29 | my $webworkRoot = shift; |
| 29 | my $webworkURLRoot = shift; |
30 | my $webworkURLRoot = shift; |
|
|
31 | my $pgRoot = shift; |
| 30 | my $courseName = shift || ""; |
32 | my $courseName = shift || ""; |
| 31 | my $safe = Safe->new; |
33 | my $safe = Safe->new; |
| 32 | |
34 | |
| 33 | # set up some defaults that the environment files will need |
35 | # set up some defaults that the environment files will need |
| 34 | $safe->reval("\$webworkRoot = '$webworkRoot'"); |
36 | $safe->reval("\$webworkRoot = '$webworkRoot'"); |
| 35 | $safe->reval("\$webworkURLRoot = '$webworkURLRoot'"); |
37 | $safe->reval("\$webworkURLRoot = '$webworkURLRoot'"); |
|
|
38 | $safe->reval("\$pgRoot = '$pgRoot'"); |
| 36 | $safe->reval("\$courseName = '$courseName'"); |
39 | $safe->reval("\$courseName = '$courseName'"); |
| 37 | |
40 | |
| 38 | # determine location of globalEnvironmentFile |
41 | # determine location of globalEnvironmentFile |
| 39 | my $globalEnvironmentFile = "$webworkRoot/conf/global.conf"; |
42 | my $globalEnvironmentFile = "$webworkRoot/conf/global.conf"; |
| 40 | |
43 | |