Customizing with Init Files
You can do some customization by setting up either a .perldb or perldb.ini file (depending on your operating
system), which contains initialization code. This init file holds Perl
code, not debugger commands, and it is processed before the PERLDB_OPTS environment variable is looked at. For instance, you could
make aliases by adding entries to the %DB::alias hash this way:
$alias{len} = 's/^len(.*)/p length($1)/';
$alias{stop} = 's/^stop (at|in)/b/';
$alias{ps} = 's/^ps\b/p scalar /';
$alias{quit} = 's/^quit(\s*)/exit/';
$alias{help} = 's/^help\s*$/|h/';You can change options from within your init file using function calls into the debugger’s internal API:
parse_options("NonStop=1 LineInfo=db.out AutoTrace=1 frame=2");If your init file defines the subroutine afterinit, that function is called after
debugger initialization ends. The init file may be located in the
current directory or in the home directory. Because this file contains
arbitrary Perl commands, for security reasons, it must be owned by the
superuser or the current user, and writable by no one but its
owner.
If you want to modify the debugger, copy perl5db.pl from the Perl library to another
name and hack it to your heart’s content. You’ll then want to set your
PERL5DB environment variable to say something like this:
BEGIN { require "myperl5db.pl" }As a last resort, you could also use PERL5DB to customize the debugger by directly setting internal variables or calling internal debugger functions. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access