WeBWorK Main Forum

Favorite debugging techniques

Favorite debugging techniques

by Andrew Dabrowski -
Number of replies: 1
Debugging seems to be potentially hair-raising with Webwork. I sometimes can't be sure whether the problem is at the Perl, Webwork, or even Apache level. That saving grace of most programmers, the print statement, is awkward or even impossible with webwork: if the problem fails to load nothing will printed at all. I just did a google search on "webwork error_log", hoping to find a way to write to the Apache log, but came up empty.

My current favorite technique is to stick this in:

BEGIN_TEXT
$BR
\{ Data::Dumper::Dumper
GR_isHamiltonianCircuit_graph_vertices( $graph, ) \}
$BR $BR $BR
END_TEXT
That gives me a nice view of an expression that might be causing trouble.

What your favorites?
In reply to Andrew Dabrowski

Re: Favorite debugging techniques

by Alex Jordan -
I'll assume you are talking about debugging a PG problem (as opposed to something with the webwork2 engine or the pg engine).

This helps a lot:
http://webwork.maa.org/pod/pg_TRUNK/macros/PGinfo.pl.html

In your example, I don't know what kind of thing $graph is, or what GR_isHamiltonianCircuit_graph_vertices is, but

\{pp( $graph ) \}
or
\{pp( GR_isHamiltonianCircuit_graph_vertices( $graph, ) ) \}

might be revealing.