- publishing free software manuals
Perl Language Reference Manual
by Larry Wall and others
Paperback (6"x9"), 724 pages
ISBN 9781906966027
RRP £29.95 ($39.95)

Sales of this book support The Perl Foundation! Get a printed copy>>>



sets debugging flags. To watch how it executes your program, use -Dtls. (This works only if debugging is compiled into your Perl.) Another nice value is -Dx, which lists your compiled syntax tree. And -Dr displays compiled regular expressions; the format of the output is explained in "Guts of Perl debugging" (perldebguts) in the Perl C API and Internals Manual.

As an alternative, specify a number instead of list of letters (e.g., -D14 is equivalent to -Dtls):

       1  p Tokenizing and parsing (with v, displays parse stack)
       2  s Stack snapshots (with v, displays all stacks)
       4  l Context (loop) stack processing
       8  t Trace execution
      16  o Method and overloading resolution
      32  c String/numeric conversions
      64  P Print profiling info, source file input state
     128  m Memory and SV allocation
     256  f Format processing
     512  r Regular expression parsing and execution
    1024  x Syntax tree dump
    2048  u Tainting checks
    4096  U Unofficial, User hacking (reserved for private, unreleased use)
    8192  H Hash dump -- usurps values()
   16384  X Scratchpad allocation
   32768  D Cleaning up
  131072  T Tokenising
  262144  R Include reference counts of dumped variables (eg when using -Ds)
  524288  J Do not s,t,P-debug (Jump over) opcodes within package DB
 1048576  v Verbose: use in conjunction with other flags
 2097152  C Copy On Write
 4194304  A Consistency checks on internal structures
 8388608  q quiet - currently only suppresses the "EXECUTING" message
16777216  M trace smart match resolution
33554432  B dump suBroutine definitions, including special Blocks like BEGIN

All these flags require -DDEBUGGING when you compile the Perl executable (but see "A data debugging tool for the XS programmer" (Devel::Peek) in the Perl C API and Internals Manual, "Perl pragma to alter regular expression behaviour" (re) in the Perl Library Reference Manual (Volume 1) which may change this). See the INSTALL file in the Perl source distribution for how to do this. This flag is automatically set if you include -g option when Configure asks you about optimizer/debugger flags.

If you're just trying to get a print out of each line of Perl code as it executes, the way that sh -x provides for shell scripts, you can't use Perl's -D switch. Instead do this

# If you have "env" utility
env PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program
# Bourne shell syntax
$ PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program
# csh syntax
% (setenv PERLDB_OPTS "NonStop=1 AutoTrace=1 frame=2";
   perl -dS program)

See 23 for details and variations.

ISBN 9781906966027Perl Language Reference ManualSee the print edition