Just thought I’d take a moment to share a couple of CPAN modules I love using for development and debugging my Perl web applications. They are not restricted to web application development, so give them a try!
DBIx::Profile
This module is a godsend when trying to figure out what is going on in DBI land. I typically include it in my Apache config: PerlModule DBIx::Profile, restart the server, and watch the log while I hit it. It shows every SQL statement as it is being run, along with the time it took for each statement to run and how many times it called each of the prepare, execute, and fetch operations. Priceless!
Carp::Always
This little gem was brought to my attention a couple of weeks ago by Andy Lester when he made it out to our Grand Rapids Perl Mongers meeting (thanks, Andy!). I had seen a slick one-liner previously that, by including in your code, would force a stack trace if anything died:
use Carp; $SIG{__DIE__} = &Carp::confess;
Carp::Always makes it even easier — just use it and you’re done. Score one for another quick, easy tool from CPAN!