I minimized the code of the problem and realized that the error comes from including "PGcourse.pl" which only includes some randomization. Excluding the macro file makes the problem work.
Here is the contents of PGcourse.pl, which I thought I just copied from another resource.
Does anyone see what I might have done improperly here?
loadMacros( "problemRandomize.pl" ) ;
#### Allow a Guest or Observer to always get a new version of problem.
ProblemRandomize( when => "Always", onlyAfterDue => 0, style => "Button" )
if ($guest or $observe) ;
#### Allow everybody else (e.g., a student) to get a new version (for more practice)
#### after correct answer(s) to first (scored) version OR after the assignment's due date
$when = (time >= $main::dueDate ? "Always" : "Correct");
ProblemRandomize( when => $when, onlyAfterDue => 0, style => "Button" )
if not ($guest or $observe) ;
Key facts about setup:
Using WW 2.12 and PG 2.12.
Problems are being edited and saved in the templates/local directory.
Check Answer error:
Warning messages
Processing of this PG problem was not completed. Probably because of a syntax error. The translator died prematurely and no PG warning messages were transmitted. at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm line 752. Odd number of elements in anonymous hash at /opt/webwork/webwork2/lib/WeBWorK/Utils/AttemptsTable.pm line 180. Use of uninitialized value in anonymous hash ({}) at /opt/webwork/webwork2/lib/WeBWorK/Utils/AttemptsTable.pm line 180.
Error messages
Can't use string ("answersSubmitted") as an ARRAY ref while "strict refs" in use at /opt/webwork/webwork2/lib/WeBWorK/Utils/AttemptsTable.pm line 202.
Call stack
The information below can help locate the source of the problem.
in WeBWorK::Utils::AttemptsTable::_init called at line 190 of /opt/webwork/webwork2/lib/WeBWorK/Utils/AttemptsTable.pmin WeBWorK::Utils::AttemptsTable::new called at line 315 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pmin WeBWorK::ContentGenerator::Problem::attemptResults called at line 1846 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pmin WeBWorK::ContentGenerator::Problem::output_summary called at line 155 of /opt/webwork/webwork2/lib/WeBWorK/Template.pmin WeBWorK::Template::template called at line 561 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pmin WeBWorK::ContentGenerator::content called at line 356 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pmin WeBWorK::ContentGenerator::Problem::content called at line 233 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pmin WeBWorK::ContentGenerator::go called at line 382 of /opt/webwork/webwork2/lib/WeBWorK.pm
Submit answer error:
Warning messages
Processing of this PG problem was not completed. Probably because of a syntax error. The translator died prematurely and no PG warning messages were transmitted. at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm line 752.
Error messages
Can't use an undefined value as a HASH reference at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/ProblemUtil/ProblemUtil.pm line 143.
Call stack
The information below can help locate the source of the problem.
in WeBWorK::ContentGenerator::ProblemUtil::ProblemUtil::process_and_log_answer called at line 765 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pmin WeBWorK::ContentGenerator::Problem::pre_header_initialize called at line 214 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pmin WeBWorK::ContentGenerator::go called at line 382 of /opt/webwork/webwork2/lib/WeBWorK.pm