Perl debugging

Key commands are:

s – step (through code)

p $var – print contents of a vaiable

r – come out of subroutine (handy since by default you go into all the library modules)

h – help gives the shit below

b – set a break point

c – continue until you hit the breakpoint

e.g.

R:Oraclescripts>perl -d qtlist.pl 2480

Enter h or `h h’ for help, or `perldoc perldebug’ for more help.

main::(qtlist.pl:1): $processes=shift;

DB s

main::(qtlist.pl:2): $wkfile=”c:\temp\qtlist_” . $processes . “.txt”;

DB s

main::(qtlist.pl:3): $wkfile2=”c:\temp\qtlist_” . $processes . “2.txt”;

DB p $wkfile

c:tempqtlist_2480.txt

DB b 26

DB s

main::(qtlist.pl:6): $syscommand = ‘tlist | findstr ‘ . $processes . ‘ > ‘ .

$wkfile;

DB c

main::(qtlist.pl:26): print $_ ;

DB p $_

2360 CMD.EXE DWHC – perl -d qtlist.pl 2480

DB c

2360 CMD.EXE DWHC – perl -d qtlist.pl 2480

main::(qtlist.pl:26): print $_ ;

DB

DB h # gives you all the help

Advertisements