loadMacros()
is that this may not be called only once. For example, some macro files load other macro files, so loadMacros()
call can even be nested. PGcourse.pl
is supposed to be the last macro file loaded, so that it can make changes to configuration for anything else that has been loaded, so getting that to work properly by modifying loadMacros()
could be a bit complicated.I think Louis is right, the place it really belongs is in the problem files.
On the other hand, there are some other ways to get something like
PGcourses.pl
without having it in every file. For example, the file parserCustomization.pl
is loaded whenever MathObjects.pl is loaded, so you can use that for customization in any MathObject-basd problem.
Hi Davide,
Resurrecting an old thread. Do all problems in the OPL now properly load PGcourse.pl? That is, were all existing OPL problems edited at some point to load this macro?
Best,
Louis
I don't know if this was ever done.
I know that there are files in the library that do not load PGcourse.pl. However, it seems that the only problems that don't do so are in the OpenProblemLibrary/UBC/MECH and OpenProblemLibrary/UBC/STAT directories.
There are also quite a few problems in the Contrib and Pending directories that don't load the macro.
I believe at some point John Jones added PGcourse.pl to all files in the OPL. Likely the UBC directories you reference were contributions that happened after this was done.
The Contrib directory is not held to the same standard as the OPL, so I could see there being a lot of files there that are missing this.
Would it make sense (and be possible) to have PG automatically load PGcourse.pl even if it isn't explicitly loaded by the problem? I don't immediately see a downside to this, as anyone using PGcourse.pl would be aware of it being loaded, and I would assume that they would want it loaded for all problems in their course.
Thanks for the replies. As I've reviewed some of our local problem sets, I've noted a smattering of problems that failed to load PGcourse.pl.
a) show a GetNewVersion button to a student after the student has earned full marks for the problem or after the assignment's dueDate
b) show a GetNewVersion button to a TA or Professor at any time
c) show a ShowProblemSource button to a TA or Professor at any time
There are several problems I use regularly despite their having no randomization:
Utah/Trigonometry/set11_Analytic_Trigonometry/p10.pg
Utah/Trigonometry/set12_Additional_Topics_in_Trigonometry/p6/p6.pg
Since there can be no new version of these problems, I would comment-out a loading of PGcourse.pl if it were in the source file.
Note: the snippet posted at
http://webwork.maa.org/wiki/Customize_Course
omits my initial lines
## Note: usual path for loading macro files includes an identically-named file
## which does nothing; problem files which explicitly load PGcourse.pl will be
## usable by any course, independent of the course having its own version.
sub _PGcourse_init {}; #### Don't reload this file.
so Davide's comment about the possibility of loadMacros being used several times becomes more significant since my version would be loaded only on the first use of loadMacros (rather than being last on the last use of loadMacros).
The line
loadMacros( 'source.pl' ) if $observe ;
was commented out when we used this PGcourse.pl for PREP-2011 but I use it because its display of a problem's coding is much easier to read than that in an editor (and this viewing is "safe" because no accidental change can be made).
Since a student should never see the ShowProblemSource button and since an instructor might want it available for each problem, I suggest this be something settable in course.conf or localOverrides.conf provided the "if $observe" condition can be effective in that context. (Qualification: privileged shell access is probably needed to put show_source.cgi into the course's html directory with execute permission.)
WHAT are the main reasons other WeBWorK instructors/authors have for loading a PGcourse.pl file?
background:
There were some vague comments about "Show Me Another" after this summer's code-camp at Vancouver. It was unclear whether they were knowledgeable or ignorant of what was already available [and the possibility of serving different pedagogical goals]. In any event, some of my colleagues have commented about wanting the ability to reveal an answer/solution after a few failed attempts --- Paul Pearson's PeriodicRerandomization.pl provides one way to deal with that (at the price of having relevant code in each problem's code).
In the short term, I am an enthusiastic advocate for managed use of problemRandomize in PGcourse.pl. On the other hand, I suggest one of the upcoming "code-camps" focus on ideas about providing pedagogical options on a broader scale. (Part of AnnArbor-2013 involved long-range design of data structure. AIM-2007 produced some visionary ideas that are not yet implemented.)
FWiW: the few non-randomized problems which I have used several times are on the "revise, randomize, write a solution" part of my ToDo list.
John's concern about adding PGcourse.pl to the OPL problems is reversibility. How about a script that found each instance of "loadMacros(", found the next ");", and then after that, inserted a second loadMacros call:
"loadMacros("PGcourse.pl"); # inserted to all OPL problems 10/24/13"
A special string like that, with the comment to identify it, would make it easy for a mass text editor to remove such strings later.