During startup, options are initialized from
$ENV{PERLDB_OPTS}
. You may place the initialization
options TTY
, noTTY
,
ReadLine
, and NonStop
there.
If your init file contains:
parse_options("NonStop=1 LineInfo=tperl.out AutoTrace");
then your program will run without human intervention, putting
trace information into the file db.out. (If you
interrupt it, you'd better reset LineInfo
to
/dev/tty if you expect to see anything.)
The following options can be specified only at startup. To set
them in your init file, call
parse_options(
"OPT
=
VAL
")
.
TTY
noTTY
If set, the debugger goes into NonStop
mode and will not connect to a terminal. If interrupted (or if
control goes to the debugger via explicit setting of
$DB::signal
or $DB::single
from the Perl program), it connects to a terminal specified in
the TTY
option at startup, or to a terminal
found at run time using the Term::Rendezvous
module of your choice.
This module should implement a method named
new
that returns an object with two methods:
IN
and OUT
. These should
return filehandles for the debugger to use its input and output
correspondingly. The new
method should
inspect an argument containing the value of
$ENV{PERLDB_NOTTY}
at startup, or
"/tmp/perldbtty$$
" otherwise. This file is
not inspected for proper ownership or wide-open write access, so
security hazards are theoretically possible.
ReadLine
If false, ReadLine
support in
the debugger is disabled in order to debug applications that
themselves use a ReadLine
module.
NonStop
If set, the debugger goes into noninteractive
mode until interrupted, or your program sets
$DB::signal
or
$DB::single
.
Options can sometimes be uniquely abbreviated by the first letter, but we recommend that you always spell them out in full, for legibility and future compatibility.
Here's an example of using the
PERLDB_OPTS
environment variable to set options
automatically.[1] It runs your program noninteractively, printing
information on each entry into a subroutine and for each line
executed. Output from the debugger's trace are placed into the
tperl.out file. This lets your program still use
its regular standard input and output, without the trace information
getting in the way.
$ PERLDB_OPTS="NonStop frame=1 AutoTrace LineInfo=tperl.out" perl -d myprog
If you interrupt the program, you'll need to quickly reset to
O LineInfo=/dev/tty
or whatever makes sense on your
platform. Otherwise, you won't see the debugger's prompting.
[1] We're using sh shell syntax to show environment variable settings. Users of other shells should adjust accordingly.