in reply to Tests for CGI apps

This is the very problem I aim to solve (at least in part) with HTML::Template::Dumper. I imagine a system that works this way:

  1. A machine in your office runs a daily cron job which points to a directory containing your test scripts
  2. To start the process, the test scripts has your web server create a file at /tmp/debug_mode, which allows your CGIs to take a DEBUG=1 parameter, which in turn causes them to use the HTML::Template::Dumper module (among other things you might want to use in debug mode
  3. Your test scripts use LWP to send various parameters to your CGIs. Normal rules about tests apply here. Using HTML::Template::Dumper means that checking the output from your CGI is as easy as walking a hash.
  4. After all the tests run, the web server is told to get rid of the /tmp/debug_mode file so that CGIs will no longer allow a DEBUG parameter
  5. A final report is sent to the web master and/or saved in a database

The /tmp/debug_mode file means you could run the tests against your production web server with debug mode only allowed for a limited period of time. You probably don't want debugging information leaking out on a regular basis (though for many CGIs, it will probably be little more than would be filled into a template anyway). More sophisticated cryptographic techniques for turning on debug mode are also possible, if you're really concerned about security.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated