Friday, May 28, 2010

How to Debug a Perl Script

Programmers do not know how to debug is blind. Perl comes with a built-in debugger that allows you to do debugging without separately install a debugger.
To debug a Perl script, simply use "-d" flag:
Debug_Perl
Here are the common use commands:
  • s - Single step. It will step into a subroutine.
  • n - Next, steps over subroutines.
  • r - Return from the subroutine.
  • c - Continue until a breakpoint if any.
  • b [ln|event|sub] - Set a breakpoint.
  • l [line|sub] - List source code.
  • p expr - Print expression.
  • q - Quit.
For details, visit http://perldoc.perl.org/perldebug.html. Cheers!

No comments:

Post a Comment