The Perl Debugger - PowerPoint PPT Presentation

About This Presentation
Title:

The Perl Debugger

Description:

http://www.mirimar.net/ Credits / For more info. Based loosely on perldebtut. Also, don't forget perldeb. Inside the debugger: h h or h [cmd] ... IDEs. ActiveState PDK ... – PowerPoint PPT presentation

Number of Views:146
Avg rating:3.0/5.0
Slides: 19
Provided by: issacgo
Category:
Tags: debugger | ides | perl

less

Transcript and Presenter's Notes

Title: The Perl Debugger


1
The Perl Debugger
  • Issac Goldstand
  • isaac_at_cpan.org
  • Mirimar Networks
  • http//www.mirimar.net/

2
Credits / For more info
  • Based loosely on perldebtut
  • Also, dont forget perldeb
  • Inside the debugger h h or h cmd

3
Before we even get to the debugger
  • Have you
  • Turned on warnings via use warnings or perl w?
  • Do you use strict wherever possible?
  • Does your script pass syntax checking
    (perl c)?

4
Example 1 Hello World
  • !/usr/bin/perl
  • var1 Hello, world!
  • var2 varl\n
  • print var2

5
When not to use the debugger
  • Not every case needs the debugger
  • The debugger would not have provided any
    significant help with the previous example
  • It is important to use other tools to find
    problems

6
What to use?
  • perl5db.pl The command line debugger
  • GUI debugger ptkdb
  • ActiveState PDK, Komodo

7
Starting the debugger
  • Called by perl d
  • Can be command line option perl d myscript.pl
  • or part of the shebang line !/usr/bin/perl -d

8
The MOST IMPORTANT COMMAND
9
The MOST IMPORTANT COMMAND
  • q Quits the debugger

10
The SECOND MOST IMPORTANT COMMAND
11
The SECOND MOST IMPORTANT COMMAND
  • h Displays help

12
The text debugger
  • Other common commands
  • v line View around line (current line by
    default)
  • x expr Evaluates an expression (in list
    context)
  • m expr Shows methods that expr-gtcan do
  • s Step into
  • n Step over
  • c line Set a one time breakpoint

13
Working with variables symbols
  • M shows currently loaded modules versions
  • S shows currently available subroutines
  • X / V shows variables in current package

14
Looking around
  • v Shows a block of code, starting from
    current position
  • l shows a single line of code, starting from
    current position
  • Either command takes an optional parameter of a
    line number
  • . resets the line position to the current line

15
Practical use
  • Normal command line scripts
  • CGI scripts via debug pragma or command
    arguments
  • mod_perl via ApacheDB
  • Not helpful for XSUB debugging

16
GUIs
  • ptkdb
  • IDEs
  • ActiveState PDK
  • Ive personally found the PDK to be very weak
    (while somewhat simpler to navigate, set
    breakpoints, etc)

17
Komodo
  • ActiveStates opensource-language IDE
  • Costs
  • New version 3.0 just released with very complete
    GUI debug tools
  • Includes supports for watches, conditional
    breakpoints, immediate pane, etc
  • Includes support for simulating full CGI
    environment

18
The End
Issac Goldstand ltisaac_at_cpan.orggt Mirimar
Networks http//www.mirimar.net/
Write a Comment
User Comments (0)
About PowerShow.com