Perl Debugger
What it is
Perl Debugger is an interactive debugging tool included with Perl, not a separate program. Running Perl with the `-d` flag loads the debugger and adds source information, letting users inspect code, set breakpoints, view stack backtraces, and change variable values. Commands support stepping into subroutine calls, stepping over them, and tracing execution. Users can set conditional breakpoints and watch global expressions for changes; the `x` command can recursively pretty-print nested data. The code must compile correctly before debugging. Lexical-variable display requires PadWalker version 0.08 or higher, while full command-line editing requires Term::ReadKey and a Term::ReadLine module. Compile-time executable statements such as `BEGIN`, `UNITCHECK`, `CHECK`, and `use` are not stopped, though some can be traced with AutoTrace. The debugger cannot provide stack-frame information for functions not compiled by Perl, such as C or C++ extensions, and it does not currently work with Perl's `-W` switch. It is free and listed for Linux, macOS, and Windows.
For and against
For
- Included with Perl at no cost
- Supports conditional breakpoints and global watches
- Can step into or over subroutine calls
- Pretty-prints nested data structures
- Available for Linux, macOS, and Windows
Against
- Code must compile correctly before debugging
- Lexical inspection requires PadWalker version 0.08 or higher
- Cannot inspect stack frames for C or C++ extension functions
- Does not currently work with Perl's -W switch
The verdict
Perl Debugger offers interactive inspection and execution controls for Perl programs without being a separate product. Its compile-time and native-extension limitations matter for projects that depend on those code paths.
Who it suits
It suits Perl developers who want to inspect program execution, set conditional breakpoints, or watch global values. It requires code that compiles correctly.
Plans and prices
Perl Debugger
Included with Perl; requires the program to compile correctly before debugging
Read 7 Oct 2026 · perldoc.perl.org
On the record
- Breakpoints and watches
- Users can set conditional breakpoints and watch global expressions for changes.perldoc.perl.org · read 7 Oct 2026
- Built into Perl
- The debugger is not a separate program; Perl’s `-d` flag makes the compiler insert source information and preload the debugger library.perldoc.perl.org · read 7 Oct 2026
- Compile requirement
- The code must compile correctly for the debugger to work on it.perldoc.perl.org · read 7 Oct 2026
- Compile-time limit
- Compile-time executable statements such as BEGIN, UNITCHECK, CHECK, and use statements are not stopped by the debugger, though some compile-time code can be traced with AutoTrace.perldoc.perl.org · read 7 Oct 2026
- Compile-time limitation
- Compile-time executable statements such as `BEGIN`, `UNITCHECK`, `CHECK`, and `use` are not stopped by the debugger, though some can be traced with `AutoTrace`.perldoc.perl.org · read 7 Oct 2026
- Customizable
- Debugger options can be set interactively, through the PERLDB_OPTS environment variable, or in customization files.perldoc.perl.org · read 7 Oct 2026
- Customization
- Options can be set interactively, through `PERLDB_OPTS`, or in `.perldb` customization files.perldoc.perl.org · read 7 Oct 2026
- Editor connections
- The LineInfo option provides a mechanism to interact with client editors or visual debuggers, with vi, emacs, and ddd given as examples.perldoc.perl.org · read 7 Oct 2026
- GUI option
- The documentation describes debugging a program through the Devel::ptkdb GUI using `perl -d:ptkdb`.perldoc.perl.org · read 7 Oct 2026
- Inspect and control execution
- Debugger commands can examine source code, set breakpoints, show stack backtraces, and change variable values.perldoc.perl.org · read 7 Oct 2026
- Inspect values
- The x command evaluates an expression and pretty-prints nested data structures recursively.perldoc.perl.org · read 7 Oct 2026
- Interactive evaluation
- Commands the debugger does not recognize are evaluated as Perl code in the current package.perldoc.perl.org · read 7 Oct 2026
- Native extension limitation
- The debugger cannot provide stack-frame information or debug functions that were not compiled by Perl, such as C or C++ extension functions.perldoc.perl.org · read 7 Oct 2026
- Notable limit
- The debugger cannot provide stack-frame information for functions not compiled by Perl, such as those from C or C++ extensions.perldoc.perl.org · read 7 Oct 2026
- Optional dependencies
- Lexical variable inspection requires PadWalker, and full command-line editing requires Term::ReadKey and a Term::ReadLine module.perldoc.perl.org · read 7 Oct 2026
- Platform availability
- The Perl download page lists Perl as included on Unix/Linux and macOS, and provides a Windows option through Strawberry Perl.perl.org · read 7 Oct 2026
- Project licensing
- Perl is open source and is licensed under either the Artistic License or the GNU General Public License.perl.org · read 7 Oct 2026
- Purpose
- The Perl source debugger runs scripts interactively and lets users inspect source, set breakpoints, get stack backtraces, and change variable values.perldoc.perl.org · read 7 Oct 2026