Darwyn - You have got to be kidding me... I just addressed a security vulnerability with the PDL constructor, but I had assumed that it wouldn't have been an issue. :-D However, you are using Safe.pm and evaling code anyway, so it wouldn't be an issue for you.
I'd love to help you out, but clearly WeBWorK does some non-standard namespace handling sort of stuff. Could you point me to some docs about writing macros? That would help a lot. Once I understand how macros work, I'll likely be able to provide more guidance on how to expose the PDL interface to your students, and how to properly handle their answers. David On Mon, Nov 14, 2011 at 8:00 PM, darwyn cook <[email protected]> wrote: > 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 > > -- Sent via my carrier pigeon.
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
