Warnings and Errors Explained
Debugging Code in Single-Server Mode
Tracing System Calls
Tracing mod_perl-Specific Perl Calls
Debugging Perl Code
Analyzing Dumped core Files
Hanging Processes: Detection and Diagnostics
Useful Debug Modules
Looking Inside the Server
Every programmer needs to know how to debug his programs. It is an easy task with plain Perl: just invoke the program with the -d flag to invoke the debugger. Under mod_perl, however, you have to jump through a few hoops.
In this chapter we explain how to correctly handle server, program, and user errors and how to keep your user loyal to your service by displaying good error messages.
We also demonstrate how you can peek at what is going on in a mod_perl-enabled server while it is running: for example, monitoring the value of a global variable, seeing what database connections are open, tracing what modules were loaded and their paths, checking the value of @INC, and much more.
It's been said that there's always one more bug in any given program. Bugs that show symptoms during the development cycle are usually easily found. As their number diminishes, the bugs become harder to find. Subtle interactions between software components can create bugs that aren't easily reproduced. In such cases, tools and techniques that can help track down the offending code come in handy.