|
|
1 | ################################################################################ |
|
|
2 | # WeBWorK mod_perl (c) 1995-2002 WeBWorK Team, Univeristy of Rochester |
|
|
3 | # $Id$ |
|
|
4 | ################################################################################ |
|
|
5 | |
| 1 | package WeBWorK::CourseEnvironment; |
6 | package WeBWorK::CourseEnvironment; |
| 2 | |
7 | |
| 3 | use strict; |
8 | use strict; |
| 4 | use warnings; |
9 | use warnings; |
| 5 | use Safe; |
10 | use Safe; |
| … | |
… | |
| 71 | bless $self, $class; |
76 | bless $self, $class; |
| 72 | return $self; |
77 | return $self; |
| 73 | } |
78 | } |
| 74 | |
79 | |
| 75 | 1; |
80 | 1; |
|
|
81 | |
|
|
82 | __END__ |
|
|
83 | |
|
|
84 | =head1 NAME |
|
|
85 | |
|
|
86 | WeBWorK::CourseEnvironment - Read configuration information from global.conf |
|
|
87 | and course.conf files |
|
|
88 | |
|
|
89 | =head1 SYNOPSIS |
|
|
90 | |
|
|
91 | use WeBWorK::CourseEnvironment; |
|
|
92 | $courseEnv = WeBWorK::CourseEnvironment->new($webworkRoot, $courseName); |
|
|
93 | |
|
|
94 | $timeout = $courseEnv->{sessionKeyTimeout}; |
|
|
95 | $mode = $courseEnv->{pg}->{options}->{displayMode}; |
|
|
96 | # etc... |
|
|
97 | |
|
|
98 | =head1 DESCRIPTION |
|
|
99 | |
|
|
100 | The WeBWorK::CourseEnvironment module reads the system-wide F<global.conf> and |
|
|
101 | course-specific F<course.conf> files used by WeBWorK to calculate and store |
|
|
102 | settings needed throughout the system. The F<.conf> files are perl source files |
|
|
103 | that can contain any code allowed under the default safe compartment opset. |
|
|
104 | After evaluation of both files, any package variables are copied out of the |
|
|
105 | safe compartment into a hash. This hash becomes the course environment. |
|
|
106 | |
|
|
107 | =head1 CONSTRUCTION |
|
|
108 | |
|
|
109 | =over |
|
|
110 | |
|
|
111 | =item new (ROOT, COURSE) |
|
|
112 | |
|
|
113 | The C<new> method finds the file F<conf/global.conf> relative to the given ROOT |
|
|
114 | directory. After reading this file, it uses the C<$courseFiles{environment}> |
|
|
115 | variable, if present, to locate the course environment file. If found, the file |
|
|
116 | is read and added to the environment. |
|
|
117 | |
|
|
118 | =back |
|
|
119 | |
|
|
120 | =head1 ACCESS |
|
|
121 | |
|
|
122 | There are no formal accessor methods. However, since the course environemnt is |
|
|
123 | a hash of hashes and arrays, is exists as the self hash of an instance |
|
|
124 | variable: |
|
|
125 | |
|
|
126 | $courseEnvironment->{someKey}->{someOtherKey}; |
|
|
127 | |
|
|
128 | =head1 AUTHOR |
|
|
129 | |
|
|
130 | Written by Sam Hathaway, sh002i (at) math.rochester.edu. |
|
|
131 | |
|
|
132 | =cut |