I use two independent debugging techniques when developing webmin/apache modules:

1. The first one is a kind of logging, complementary to what webmin already does.  Webmin logs to a single file for all requests, I log to a set of rotating files, each file contains a information of the execution of cgi script.  The implementation of this can be found in the sesa scripts, a small application framework on top of webmin (available on sourceforge.net/projects/sesa, the specific files that implement the feature are Sems.pm and Persistency.pm).  The advantage of these log files is that they don't fill your disk (they are rotating), and give you a good history of what a user has done in the recent past.  The disadvantage is obviously performance.

2. From CPAN, there is a module Devel::ptkdb that allows to do source code debugging, also for cgi scripts running on a remote server.  To do this, you set the DISPLAY variable to your display (where your browser is runnning), in a very first _BEGIN_ block in your cgi script.  Then, second, you use the interpreter sequence '#!/usr/bin/perl -d:ptkdb' to call the debugger.  Then, make a request to the server, such that it executes your cgi script.  Perhaps small changes are required to the webmin configuration, I am not entirely sure about it (e.g. to fork cgi scripts ?).  I have used this technique a lot for debugging complicated cgi scripts.


Paul Gear <paul@gear.dyndns.org> wrote:
Hi folks,

I've made a few useful (i think) changes to the Shorewall module, and i
plan to make a few more before i send in the patches. However, i would
like to do some more testing & debugging, and i'd like to know what sort
of debugging tools are at my disposal.

From what i can tell, the Perl errors from my module actually go nowhere
at all. Is this correct/intended? What is the preferred mechanism to
capture Perl errors and produce debug output? I've experimented with
saving temporary files using a technique i borrowed from another module,
and that seems to work sometimes, but not always (and possibly is
dependent upon the actual path used). I'm confused! :-(

Thanks in advance,

Did you know? It is illegal to use your copy of Microsoft Office on
multiple computers without multiple licenses. Why not try the free
alternative OpenOffice.org?

This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/-
Forwarded by the Webmin development list at webmin-devel@webmin.com
To remove yourself from this list, go to

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.