Forum archive 2000-2006

Maria Voloshina - How to use Perl modules in Webwork

Maria Voloshina - How to use Perl modules in Webwork

by Arnold Pizer -
Number of replies: 0
How to use Perl modules in Webwork topic started 7/2/2001; 3:25:23 PM
last post 7/2/2001; 3:25:23 PM
userMaria Voloshina - How to use Perl modules in Webwork  blueArrow
7/2/2001; 3:25:23 PM (reads: 697, responses: 0)
After installing a module (see http://www.cpan.org/modules/INSTALL.html for an explanation how to do this), move the module into the courseScripts directory.

You may need to rename it so that there are no ':' in the module name. For example, we renamed Statistics::Distributions.pm to Distributions.pm.

Next, add the module name to PG_module_list.pl.

Finally, add your module to the sub _*_init in an appropriate macro file, so that in the problems, you can call the functions directly by their names like 'uprob(2,3)' instead of Distributions::uprob(2,3). You will have to load this macro file in your problems then. Here is how this is done in PGstatisticsmacros.pl:

sub _PGstatisticsmacros_init { foreach my $t (@Distributions::EXPORT_OK) { *{$t} = *{"Distributions::$t"} } foreach my $t (@Regression::EXPORT_OK) { *{$t} = *{"Regression::$t"} } }

Maria.

<| Post or View Comments |>