I ran into this problem with WW 2.12 on Ubuntu. Here's a MWE.
DOCUMENT();
loadMacros("PGstandard.pl",
"PGML.pl",
"MathObjects.pl"
);
TEXT(&beginproblem);
$showPartialCorrectAnswers = 1;
SRAND(1017);
Context("Matrix");
$id = Value::Matrix->I(3);
Context()->constants->add(I=>$id);
$form = Formula('I');
$ans = Formula('I');
BEGIN_PGML
[`[$form]= `][______]{$ans}.
END_PGML
ENDDOCUMENT();
Then "I" is not accepted as the correct answer. I get the error message:
'Can't locate object method "transferFlags" via package "1" (perhaps you forgot to load "1"?)'
Oddly this seems to be only a problem with the letter I. You don't suppose WW could be construing it as a Roman numeral?
Hi Andrew,
Have you tried using
Context()->constants->replace(I=>$id);
or
Context()->constants->remove(I);
Context()->constants->add(I=>$id);
or
Context()->constants->are(I=>$id);
For more options, see:
http://webwork.maa.org/wiki/Introduction_to_Contexts#Changing_Context_Settings
Sorry that I don't have time to try these out myself. Please report back whether they work.
Take care,
Paul Pearson
Thanks for responding.
Context()->constants->are(I=>$id);
produces the same error message as originally ('Can't locate object method "transferFlags...).
->remove and ->replace produce that error message along with a new one, "Constant 'I' doesn't exist at [PG]/lib/Value/Context/Data.pm line 103".
Context()->constants->are(I=>$id);
produces the same error message as originally ('Can't locate object method "transferFlags...).
->remove and ->replace produce that error message along with a new one, "Constant 'I' doesn't exist at [PG]/lib/Value/Context/Data.pm line 103".
Hi Andrew,
I'm getting the same error you are. Using PGinfo.pl, I am able to see that "I" has been added to the context (see code below). The error message suggests to me that the problem is something internal to MathObject's context flags, and that it is "above my pay grade" (which isn't saying much since I'm not being paid for this!). Perhaps someone who knows the internals of contexts could provide a better answer.
Best regards,
Paul Pearson
##########################################
DOCUMENT();
loadMacros("PGstandard.pl",
"PGML.pl",
"MathObjects.pl",
"PGinfo.pl",
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
SRAND(1017);
Context("Matrix");
$id = Value::Matrix->I(3);
Context()->constants->add(I=>$id);
$ans = Formula('I');
BEGIN_PGML
[`[$ans]= `][______]{$ans}.
[@
listContext(Context());
# listContextFlags();
# listVariables();
@]
END_PGML
ENDDOCUMENT();
So it seems to be a bug. Is there a place for bug reports?
WebWork uses Bugzilla: