I use
Test::More and
Test::WWW::Mechanize to write unit tests for the models and controllers, and use
Log::Log4perl to print debugging information in the modules to the error log. I use the perl debugger to step through each of the tests while I write them akin to the technique described in
Interactive scripting with debugger.
It takes some patience and practice, but I can find errors quickly because of the Log::Log4perl output which contains module line numbers, and once the test is passing I rarely have to come back to the same problem.