WeBWorK Problems

Setting new symbol in Currency context

Setting new symbol in Currency context

by Tim Flowers -
Number of replies: 1

Here are a few of the lines in one of my problems:

70		Context("Currency");
71		Context()->currency->set(symbol=>'#');   
72		Context()->flags->set(trimTrailingZeros=>1);
73		$a = Currency(1000*$yinit);
74		$b = Currency(1000*$givenvisit);

I have the contextCurrency.pl in the loaded macros. The problem is giving the following error:

ERRORS from evaluating PG file: 
No definition for operator '$' in the given context at line 376 of [PG]/macros/contextCurrency.pl Died within Currency::Context::currency::update called at line 332 of [PG]/macros/contextCurrency.pl from within Currency::Context::currency::set called at line 71 of (eval 4170)
This problem worked as written in version 2.15 . I am now on a server running version 2.17 and am getting the error message. 

Has something changed in how an alternate Currency symbol is set? 


In reply to Tim Flowers

Re: Setting new symbol in Currency context

by Alex Jordan -

I can confirm this is an issue in 2.18. Here is an MWE:


DOCUMENT();
loadMacros(qw( PGstandard.pl PGML.pl contextCurrency.pl));

Context("Currency")->currency->set(symbol=>'!');   
$a = Currency(1000);
 
ENDDOCUMENT();