Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to debug unknown dynamic code?

by runrig (Abbot)
on Dec 28, 2000 at 11:58 UTC ( [id://48605]=note: print w/replies, xml ) Need Help??


in reply to How to debug unknown dynamic code?

In addition to what tilly says, why not just break on the line that contains '&$function($arg1, $arg2)' and then step to the next statement and see where it goes. Which brings me to why I've forced myself to learn the debugger (with which I am now mediocre). merlyn says just don't put bugs in your code, and write small bits of code that work, which is great when you're writing your own code.

When you're maintaining someone elses 3000+ line (not including modules) spaghetti code that uses neither strict nor warnings, and you're wondering how the program got from point A to point B and how some global variable seemed to get magically populated (by some module C), to me there's nothing like a decent debugger to trace the (@#$@#!!) damn thing. And sometimes I don't want to put in print statements to see what "$a" is at point A, because then I just have to remove (or comment out) the print statement later, or by the time I get to point A, I find that I really wanted to see what "$b" was, and with a debugger I can do that without restarting the whole program.

I've worked with other programmers (in another language, 4gl if you must know) that couldn't use a debugger, and stared at a problem for days wondering what was going on, when with the help of the debugger the problem was found (in some deep dark library) in an hour or two.

I think that the only thing (that I can think of at the moment) that the perl debugger needs is the ability to save break points and/or accept some input script (like break at line 100; step 1 line (requiring some module), then break at some function in that module if $i > 54). If someone knows how to do this, please let me know :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2024-04-23 08:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found