Reputation: 8874
I often need to debug in my Perl program, some of them are very big, and are not started by perl xxx.pl.
I have use Python's pdb module, which can set a breakpoint in program by using
pdb.set_trace()
When execute to the point, program will give out a python interactive shell. Then I can debug. I want to know that is there a such debug module or method in Perl? I also want to know other debug support in perl and its modules.
Upvotes: 5
Views: 645
Reputation: 8874
I found the Module : Enbugger -- Enables the debugger at runtime.
which is what was i wanted.
CLASS->stop
which can stop the running of program and give out a debug shell .
it also can load many type of debugger, by default , it is perl5db
.
you can specify other debugger such as this powerful one debugger: Devel::Trepan
Upvotes: 1
Reputation: 5069
Here is a good tutorial for debugging Perl script:
http://www.ehow.com/how_2095026_debug-perl-programs.html
perl -d yourscript.pl
Set breakpoints using the "b" command in sections of the code you think are broken. Breakpoints tell the debugger to stop debugging when it reaches that line or function. They can be set on lines or functions and can have conditions attached. For example, to set a breakpoint on line 531 with the condition of "$a > 10", you would use the following command: "b 531 $a > 10"
Run the program, using the "r" command. This will run the program until a breakpoint is reached.
Upvotes: 1