The perl debugger
1 / 18

The Perl Debugger - PowerPoint PPT Presentation

  • Uploaded on

The Perl Debugger. Issac Goldstand Mirimar Networks Credits / For more info. Based loosely on perldebtut Also, don’t forget perldeb Inside the debugger: h h or h [cmd]. Before we even get to the debugger…. Have you:

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'The Perl Debugger' - angelo

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
The perl debugger

The Perl Debugger

Issac Goldstand

Mirimar Networks

Credits for more info
Credits / For more info

  • Based loosely on perldebtut

  • Also, don’t forgetperldeb

  • Inside the debugger: h horh [cmd]

Before we even get to the debugger
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)?

Example 1 hello world
Example 1 – Hello World


$var1 = ’Hello, world!’;

$var2 = “$varl\n”;

print $var2;

When not to use the debugger
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

What to use
What to use?

  • – The command line debugger

  • GUI debugger – ptkdb

  • ActiveState – PDK, Komodo

Starting the debugger
Starting the debugger

  • Called by perl –d

  • Can be command line option: perl –d

  • …or part of the shebang line: #!/usr/bin/perl -d

The most important command1

  • q – Quits the debugger

The text debugger
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->can do

    s – Step into

    n – Step over

    c line – Set a “one time” breakpoint

Working with variables symbols
Working with variables & symbols

  • M shows currently loaded modules + versions

  • S shows currently available subroutines

  • X / V shows variables in [current] package

Looking around
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

Practical use
Practical use

  • Normal “command line” scripts

  • CGI scripts via –debug pragma or command arguments

  • mod_perl via Apache::DB

  • Not helpful for XSUB debugging

The perl debugger

  • ptkdb

  • IDEs

  • ActiveState PDK

  • I’ve personally found the PDK to be very weak (while somewhat simpler to navigate, set breakpoints, etc)


  • ActiveState’s 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

The end
The End

Issac Goldstand


Mirimar Networks