WeBWorK Main Forum

use of perl modules in questions

use of perl modules in questions

by Zak Zarychta -
Number of replies: 1
Is is possible to invoke perl modules in questions?

inclusion of

use Math::Bigfloat

results with the following

'require' trapped by operation mask at line 25 of (eval 998)

Zak
In reply to Zak Zarychta

Re: use of perl modules in questions

by Michael Gage -
If you have access to the server you can add perl modules to questions.

The modules have to be loaded explicitly in the global.conf file
(you'll see where if you look down toward the end of the file).

"use" and "require" are restricted from use in problems or in .pl macros
which are easily modified from the web as a security measure.

Once the modules have been shared with the Safe compartment they can be called in problems. The usual practice is to create some macro file that provides a front end and simplifies the calls since you don't usually need the full power of the perl module.

Davide Cervone might have some suggestions about parsing the numbers in the answer which could help satisfy your requirements. If one wants to distinguish between 2.8 and 2.80 then string comparison may be the choice you want.

Good luck -- let us know if you find something that works just right for this.