in reply to Module implementing modified comment-style debugging.

Comment on the supplemental question:

If you are debugging a cgi script, why not use something in the url to set your debug level.

For example, if your normal call is

http://website/path/bla.html
then you set debug level to 1 with
http://website/path/bla.html?d=1
or
http://website/1/path/bla.html
or
http://website/path/bla.html1
With a suitable apache configuration and an init routine to get the number out of the URL and a debug routine like oko1 or apl proposed you could avoid editing your script to turn debugging on or off.