Hi all,
In the classes I teach, I use a free online homework system called
WeBWorK <http://webwork.maa.org/>. In the background WeBWorK uses perl
to code problems, it would be really nice to have access to PDL to write
some more advanced problems. For example, I am writing problems for a
PDE course that require Bessel functions.
I have PDL installed on our WeBWorK server, and working properly.
WeBWorK uses the module safe.pm to protect itself from student hackers,
so the PDL modules I need have to be installed in a way that safe
recognizes them.
The recommended way to do this is to move the corresponding PDL module
to a specific directory on the server, /pg/lib , update the config
file for webwork to recognize the module is installed, and then write a
header file in another directory which you then include in your problems.
For the Bessel functions I moved BESSEL.pm to the /pg/lib directory
mentioned above, installed this module in the config file, and wrote a
header file that calls bessjn. That seems to work fine, the problems
recognize that bessjn exists. However, the output of bessjn is a piddle
(correct?), which I need to make into a perl variable so WeBWorK will
recognize it. No problem, I can just use the sclr command built into Core.pm
Except I cannot get WeBWorK to recognize Core.pm. I moved a copy into
/pg/lib, and added it to the config file just as I did with BESSEL.pm.
Made sure that Core.pm allows sclr to be exported in its EXPORT_OK
command, but WeBWorK still cannot find sclr. Any thoughts on how to
make this work would greatly appreciated.
Darwyn
P.S. Here are the contents of the macro file that I put into a webwork
problem. You may notice that I also am importing Math.pm also as an act
of desperation.
sub _PGspecialfunctionsmacros_init {
foreach my $t (@BESSEL::EXPORT_OK) {
*{$t} = *{"BESSEL::$t"}
}
foreach my $t (@Math::EXPORT_OK) {
*{$t} = *{"Math::$t"}
}
foreach my $t (@Core::EXPORT_OK) {
*{$t} = *{"Core::$t"}
}
}
=head1 Special Functions Macros
=head3 Bessel Functions
=pod
Usage: besseljn(x,n)
=cut
############################################
sub besseljn {
my ($a,$b) = @_;
$x = bessjn($a,$b);
return sclr($x);
}
1;
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl