Debugging

There’s a debugger that comes with Perl and supports breakpoints, watchpoints, single-stepping, and most things you’d want in a command-line Perl debugger. It’s written in Perl, so if there are bugs in the debugger, we’re not sure how they get those out. In addition to all of the usual debugger commands, you can run Perl code from the debugger—calling your subroutines, changing variables, even redefining subroutines—while your program is running. See the perldebug manpage for the latest details. The Alpaca gives a detailed walkthrough of the debugger.

Another debugging tactic is to use the B::Lint module, which is still preliminary as of this writing.

Get Learning Perl, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.