Forum archive 2000-2006

Michael Gage - PG environment variables

Michael Gage - PG environment variables

by Arnold Pizer -
Number of replies: 0
inactiveTopicPG environment variables topic started 5/11/2000; 6:08:29 PM
last post 2/8/2001; 8:37:24 PM
userMichael Gage - PG environment variables  blueArrow
5/11/2000; 6:08:29 PM (reads: 3843, responses: 2)

PG environment variables

Vital state information

$psvn
psvn (Problem set version number) is a number which identifies an individual problem set. This is the primary key in the record table defining the problem set.
$psvnNumber
A synonym for $psvn
$probNum
Problem number. This number identifies the order in which this problem appears in the problem set.
$questionNumber
Synonym for $probNum
$fileName
The path to the template for this problem (relative to the template directory.)
$probFileName
A synonym for $fileName
$problemSeed
The number used to initialize the random number generator. A problem seed is stored for each problem in each individualized problem set record. The template ($fileName) and seed ($problemSeed) completely determine the individual problem seen by the student. Changing the seed changes the coefficients in the problem. Using the same seed for all students gives them identical problems.
$displayMode
One of HTML (text mode), HTML_tth (formatted text mode) or Latex2HTML (typeset mode)
$languageMode
Obsolete synonym for $displayMode
$outputMode
Obsolete synonym for $displayMode

Problem Information

This information can be read, but altering it affects nothing outside the problem. The dates are guaranteed to be in ascending order.
$formattedOpenDate
Text string containing the date after which students will be able to view the problems.
$openDate
Number representing the date in the unix system. This is useful for comparing dates.
$formattedDueDate
Text string containing the due date of the problem set. After this date, answers are not recorded.
$dueDate
Number representing the date in the unix system. This is useful for comparing dates.
$formattedAnswerDate
Text string containing the date the answers will be viewable by students .
$answerDate
Number representing the date in the unix system. This is useful for comparing dates.
$numOfAttempts
The number of previous times this problem has been attempted. You can use this to trigger hints or other information.
$problemValue
A number (default is 1) representing the problem value within the set. Hard problems can be assigned a greater weight from the professor page.
$sessionKey
A string which is used as the time limited "password" for this session. (A session lasts from the login until the student logs out, or the session logs out because of inactivity for more than a specified period of time (usually set to about 20 minutes). After a timeout, the student resumes by entering their password again, and a new session key is issued. One possible use of the session key is to generate the problem seed so that the student sees a new problem set with every session. This might be useful for using WeBWorK to administer gateway exams.

Student Information

$sectionName
A text string -- usually containing the name of the professor administering the lecture session.
$sectionNumber
A synonym for $sectionName
$recitationName
A text string -- usually containing the name of the TA administering the recitation session or the time and place of the recitation.
$recitationNumber
A synonym for $recitationName
$setNumber
A string identifying the set.
$studentLogin
The student's login name. At the U of R this is usually the same as their user name for the campus e-mail system.
$studentName
Text string containing the student's full name.
$studentNID
Text string containing the student's identification number.

Answer Information

$inputs_ref
A reference to a hash containing all of the inputs from the HTML form. This can be used to access the students answers. ($inputs_ref->{Answer1} will obtain the students answer to the answer rule labeled "Answer1".) This data is certainly tainted and should be used with great care.
$refSubmittedAnswers
Obsolete -- list of answers labeled with the default answer label (= AnSwEr ???). Use inputs_ref instead.

Default values for evaluating answers

functAbsTolDefault
functLLimitDefault
functMaxConstantOfIntegration
functNumOfPoints
functRelPercentTolDefault
functULimitDefault
functVarDefault
functZeroLevelDefault
functZeroLevelTolDefault
numAbsTolDefault
numFormatDefault
numRelPercentTolDefault
numZeroLevelDefault
numZeroLevelTolDefault

Directories and URL's

cgiDirectory
cgiURL
classDirectory
courseName
courseScriptsDirectory
htmlDirectory
htmlURL
macroDirectory
templateDirectory
tempDirectory
tempURL
scriptDirectory
webworkDocsURL

<| Post or View Comments |>


userZbigniew Fiedorowicz - Re: PG environment variables  blueArrow
2/6/2001; 8:18:26 PM (reads: 2820, responses: 0)
Mike, Arnie,

You should document the fact that you can define your own environment variables in webworkCourse.ph

See my post in the discussion list.

Zig

<| Post or View Comments |>


userMichael Gage - Creating your own PG environment variables  blueArrow
2/8/2001; 8:37:24 PM (reads: 3042, responses: 0)

Creating your own PG environment variables

Any element of the hash %Global::PG_environment will also be inserted as an environmental variable. These elements are most often defined in webworkCourse.ph. (Every variable in webworkCourse.ph is implicitly in the package Global::, hence in that file you don't need to include the prefix., a statement such as

$PG_environment{NEW_ENVIRONMENT_VARIABLE} = 5000;

will be enough. )

This defines an environment variable $NEW_ENVIRONMENT_VARIABLE which can be used in any problem and which has the value of 5000.

You should use this feature cautiously. Because these PG_environment environment variables are the last ones defined, they can overwrite previously defined environment variables, and this might cause unexpected problems if it is done accidently.

Here are several environment variables commonly defined in webworkCourse.ph.

PRINT_FILE_NAMES_FOR
$PG_environment{'PRINT_FILE_NAMES_FOR'} = ['gage','apizer'];

is used by the macro beginproblem() defined in PGbasicmacros.pl. If the current users name is in this array reference, then beginproblem() prints out the name of the file containing the problem template, in addition to printing the number of points the problem is worth, and other information. This is very helpful for making corrections to the problem template.

PROBLEM_GRADER_TO_USE
$PG_environment{PROBLEM_GRADER_TO_USE} = 'std_problem_grader';

Defines the 'std_problem_grader' as the one to use in grading a problem, unless the problem explicitly asks that another problem be used.

This variable is used in the ENDDOCUMENT() mac