Perl comes with a comprehensive and fully featured debugger. Unlike other languages, however, the debugger is not a separate tool but simply a special mode of the Perl interpreter, which makes use of an external library called
perl5db.pl. To enable it, we use the
-d option, after which we may step through code, set breakpoints, examine, and execute code selectively from inside the debugger.
In addition to the debugger, Perl supplies a number of modules designed for debugging support or that are simply useful for debugging. In particular, the
Safe module allows us to create a restricted environment for Perl scripts to run in, and the
Test::Harness module in conjunction with
Test, Test::Simple, or