Perl
  Home arrow Perl arrow Page 4 - Using The Perl Debugger
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Rational Software Development Conference
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PERL

Using The Perl Debugger
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 21
    2003-06-25

    Table of Contents:
  • Using The Perl Debugger
  • Step By Step
  • Breaking Free
  • A Watchful Eye
  • Acts Of Madness
  • Test Drive

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Dell PowerEdge Servers

    Using The Perl Debugger - A Watchful Eye
    (Page 4 of 6 )

    You can set a watch-expression (an expression which triggers a halt if its value changes) with the "w" command, as in the following example:


    DB<1> w $count
    DB<<3>> L
    Watch-expressions:
    $count

    Now that the watch-expression has been set, you can see how it works by writing some code to alter the value of the $count variable. The debugger will display a message every time the variable's value changes.


    DB<2> for ($count=0; $count<=10; $count++) { print "Hello!"; };
    Watchpoint 0: $count changed:
    old value: undef
    new value: '0'
    DB<<3>> s
    main::((eval 13)[/usr/lib/perl5/5.8.0/perl5db.pl:17]:2):
    2: for ($count=0; $count<=10; $count++) { print "Hello!"; };;
    DB<<3>>
    Watchpoint 0: $count changed:
    old value: '0'
    new value: '1'
    main::((eval 13)[/usr/lib/perl5/5.8.0/perl5db.pl:17]:2):
    2: for ($count=0; $count<=10; $count++) { print "Hello!"; };;
    DB<<3>> Hello!
    main::((eval 13)[/usr/lib/perl5/5.8.0/perl5db.pl:17]:2):
    2: for ($count=0; $count<=10; $count++) { print "Hello!"; };;
    DB<<3>> s
    Watchpoint 0: $count changed:
    old value: '1'
    new value: '2'
    for ($count=0; $count<=10; $count++) { print "Hello!"; };

    Watch-expressions can be deleted with the "W" command; either specify the expression


    DB<<3>> W $count

    or delete all currently-set expressions with the * wildcard.


    DB<<4>> W *
    Deleting all watch expressions ...

    Note that adding watch-expressions can result in a performance penalty, so you should try and restrict yourself to not more than three or four at any given time.

    More Perl Articles
    More By icarus, (c) Melonfire


     

       

    PERL ARTICLES

    - Perl: A Continuing Look at Hashes and Multid...
    - Perl: Another Round with Hashes
    - Perl Hashes
    - Perl Lists: A Final Look at List::Util
    - Perl Lists: Utilizing List::Util
    - Perl Lists: The Split() Function
    - SQL and CGI with Perl and DBI
    - Perl Lists: More Functions and Operators
    - SELECT Queries and Perl
    - Perl Lists: More on Manipulation
    - Creating a Database with Perl and DBI
    - Perl: Sailing the List(less) Seas
    - Perl and DBI
    - Perl: Concatenating Text and More
    - Perl Text: Quoting Without Quote Marks

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway