Following the instructions from a post by Maria Voloshina here, I've attempted to add the perl module Math::SigFigs to our locally hosted WeBWorK.
I've added the renamed perl module located at /webwork/pg/lib/SigFigs.pm to webwork/pg/macros/PG_module_list.pl and also created a file in the same directory PGSigFigsmacros.pl which contains the line
sub _PGSigFigsmacros_init {
foreach my $t (@SigFigs::EXPORT_OK) { *{$t} = *{"SigFigs::$t"} }
}
The MWE included below loads the macro file I created in line with the above advice just fine. However, it throws an exception when I try to call the function addSF from the renamed perl module located at /webwork/pg/lib/SigFigs.pm with the following error
1. ERROR caught by Translator while processing problem file:setSANDPIT/SigFig_00-0.pg
****************
ERRORS from evaluating PG file:
Undefined subroutine &main::addSF called at line 13 of (eval 1715)
The
I'd be very grateful for advice that will get me over the line with this.
Zak
####################################
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGSigFigsmacros.pl",
);
TEXT(beginproblem());
Context("Numeric");
$n1 = 123.4567898765;
$n2 = 987.654321;
$sum12 = addSF($n1,$n2);
#$sum12 = $n1 + $n2;
$ans = $sum12;
ANS( Real($ans)->cmp());
Context()->texStrings;
BEGIN_TEXT
$BR
\(n1 + n2 = $n1 + $n2\)
$BR
\(\phantom{n1 + n2} = $sum12\)
$PAR
\{ ans_rule(25) \}
END_TEXT
Context()->normalStrings;
$showPartialCorrectAnswers = 1;
ENDDOCUMENT();
##################################