NAME

WeBWorK::CourseEnvironment - Read configuration information from global.conf and course.conf files.

SYNOPSIS

 use WeBWorK::CourseEnvironment;
 $ce = WeBWorK::CourseEnvironment->new({
        webwork_url         => "/webwork2",
        webwork_dir         => "/opt/webwork2",
        pg_dir              => "/opt/pg",
        webwork_htdocs_url  => "/webwork2_files",
        webwork_htdocs_dir  => "/opt/webwork2/htdocs",
        webwork_courses_url => "/webwork2_course_files",
        webwork_courses_dir => "/opt/webwork2/courses",
        courseName          => "name_of_course",
 });
 
 my $timeout = $courseEnv->{sessionKeyTimeout};
 my $mode    = $courseEnv->{pg}->{options}->{displayMode};
 # etc...

DESCRIPTION

The WeBWorK::CourseEnvironment module reads the system-wide global.conf and course-specific course.conf files used by WeBWorK to calculate and store settings needed throughout the system. The .conf files are perl source files that can contain any code allowed under the default safe compartment opset. After evaluation of both files, any package variables are copied out of the safe compartment into a hash. This hash becomes the course environment.

CONSTRUCTION

new(HASHREF)

HASHREF is a reference to a hash containing scalar variables with which to seed the course environment. It must contain at least a value for the key webworkRoot.

The new method finds the file conf/global.conf relative to the given webwork_dir directory. After reading this file, it uses the $courseFiles{environment} variable, if present, to locate the course environment file. If found, the file is read and added to the environment.

new(ROOT URLROOT PGROOT COURSENAME)

A deprecated form of the constructor in which four seed variables are given explicitly: webwork_dir, webwork_url, pg_dir, and courseName.

ACCESS

There are no formal accessor methods. However, since the course environemnt is a hash of hashes and arrays, is exists as the self hash of an instance variable:

        $ce->{someKey}->{someOtherKey};

AUTHOR

Written by Sam Hathaway, sh002i (at) math.rochester.edu.