Re: Perl debugging



On Thu, 29 Sep 2005 09:20:09 -0700, aizenman wrote:
> Secondly, is there any way to get the debugger to load certain settings
> and breakpoints when it starts *in a given folder* or better yet *for a
> given script*? I realize I could muck with my global ~/.perldb but I'd
> prefer to have it specific to each project.

perldoc perldebug:

The code is executed in the package "DB". Note that .perldb is pro-
cessed before processing "PERLDB_OPTS". If .perldb defines the subrou-
tine "afterinit", that function is called after debugger initialization
ends. .perldb may be contained in the current directory, or in the
home directory. ^^^^^^^^^^^^^^^^^

To execute debugger commands in .perldb you can use this hack
(undocumented, don't blame me if it stops working one day):

[marvin:/tmp] peter% cat .perldb
sub afterinit { @typeahead = ('x \\%INC', 'b 6') }
[marvin:/tmp] peter% cat foo
print "one\n";
print "two\n";



print "six\n";
print "seven\n";
[marvin:/tmp] peter% perl -d foo

Loading DB routines from perl5db.pl version 1.19
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(foo:1): print "one\n";
auto(-2) DB<1> x \%INC
0 HASH(0x47518)
'./.perldb' => './.perldb'
'AutoLoader.pm' => '/Library/Perl/AutoLoader.pm'
'Carp.pm' => '/Library/Perl/Carp.pm'
[snip]
'warnings.pm' => '/Library/Perl/warnings.pm'
'warnings/register.pm' => '/Library/Perl/warnings/register.pm'
auto(-1) DB<2> b 6
DB<3> l
1==> print "one\n";
2: print "two\n";
3
4
5
6:b print "six\n";
7: print "seven\n";


--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/

.