Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: I usually debug via...

by nothingmuch (Priest)
on Feb 20, 2005 at 08:39 UTC ( #432852=note: print w/ replies, xml ) Need Help??


in reply to I usually debug via...

I think the perl debugger is not that fun.

I usually resort to tracing with any means possible... Either the program is going in the wrong direction, or it's going the right way, but carrying around the wrong data. Data::Dumper is usually used at selected points in the trace, and tracing info is added in binary search order.

I hacked Class::Publisher to allow to to say Class::Publisher->add_subscriber('*' => sub { warn "@_" }); and get a trace of events. In my recent project this helps a lot.

I use throaway warns with Data::Dumper, or without, a lot. Data::Dumper usually helps if the objects stringify, which is sometimes the case.

I sometimes use Devel:: modules to help me get more output, or better intersected output.

Someday I'd like to say that I make use of ddd, though. Or maybe Dominus will finish the new debugger... =P

-nuffin
zz zZ Z Z #!perl


Comment on Re: I usually debug via...
Download Code
Re^2: I usually debug via...
by Anonymous Monk on Feb 22, 2005 at 18:02 UTC
    The perl debugger is very poorly documented, but it's quite useful. Unlike ad-hoc trace statements, you don't risk introducing bugs by modifying your code. You also don't have to remember to take *out* all your trace statements again: the code is only modified to fix bugs or add features. You can toss breakpoints in to test branches, examine variables, or change them to see if fixing the data fixes the bug you're encountering. You can quickly examine complex data structures to see if the data you're looking for is in there: or if there's any data at all. You can't go backwards, which is frustrating, but you *can* step through an arbitrary function as it executes, which is almost as good. That means that if you have a function with no side effects, you can run through the code, find the function call that is wrong, and then single step through the function looking for why it's wrong, without re-rerunning the program. Re-running the program can be tedious, if the program runs slowly, or has a long start up time. -- AC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://432852]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2014-08-01 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (6 votes), past polls