I apologize if this is easily found information, but I have looked around and can't find it. My question is, can I use Perl's eval() in a custom answer checker? If so, exactly what is allowed and what forbidden? I get an error message about "eval string" when I try to use it in its usual form. (I know about eval() and substitute() in MathObjects, but we haven't updated past 2.2 yet. Now that you guys have made this easy with an ISO, it may happen this summer. Well, I can hope, anyway.)
More generally, is there a programmer's description of PG or at least a complete description of how it differs from Perl? I'll read the source if I have to, but a shortcut would be nice.
You can use PG_restricted_eval (described in PGbasicmacros.pl)
I recommend updating to ww22.214.171.124 (or ww126.96.36.199 if you are somewhat
brave -- we're readying that for general release very soon. I use it now). It's available at github.com/openwebwork.
There is a lot of programmers resources on the wiki -- but some of it is out of date. The MathObjects descriptions are the most recent but are not really at the programming level.
Make good use of the POD descriptions: linked to from
http://webwork.maa.org/wiki/Category:Authors and the search engine. For
Paul Pearson's document http://webwork.maa.org/wiki/File:WeBWorK_Problem_Authoring_Tutorial.pdf is a good basic reference but may dwell longer on basic perl than you need to.
And look at this collection: http://webwork.maa.org/moodle/mod/data/view.php?id=5
of 'all' the macros defined in PG. (This is somewhat out of date which is why
all is in quotes. There is a lot of documentation which is out of date but which is still relevant. Most problems coded 15 years ago will still run, but it is desirable to look around before copying them too closely.
For basic perl I think the book "Learning Perl" by Schwartz remains on of the best. I've also looked at "Modern Perl" by chromatic as a guide for new coding methods that are more in step with current practice. I'd like to incorporate some those into our WeBWorK code updates -- although they
require at least perl 5.10 and often perl 5.12 or 5.14.
And feel free to ask questions on this forum. If you see places where you can help out with the documentation for coding please do. We'll be glad to help as well.