Perl Programming Page 3 - Using The Perl Debugger |
The Perl debugger also allows you to define a variety of triggers within your script; these triggers - breakpoints, watch-expressions and actions - come in handy when you need to keep an eye on the values of different variables, since they can be set to automatically notify you in the event of a change. Breakpoints can be set with the "b" command, which may be followed with either a subroutine name or line number. The following line sets a breakpoint at the first line of the subroutine install_driver() of the DBI
When the debugger reaches this line, it will halt and wait for a new command.
You can set a one-time breakpoint with the "c" command; this command continues executing the script until the breakpoint is reached, at which point it stops and waits for a command.
You can even place a breakpoint within your Perl code, simply by adding the line
or
at the appropriate point in your script. When the debugger encounters this statement while running the script, it will automatically halt and wait for a new command. You can delete breakpoints with the "B" command, which needs either a line number
or the * wildcard to delete all breakpoints.
blog comments powered by Disqus |