Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Looking For The Obvious - Debugging Perl

by bradcathey (Prior)
on Jun 21, 2004 at 12:25 UTC ( #368416=note: print w/ replies, xml ) Need Help??


in reply to Looking For The Obvious - Debugging Perl

As the quote in my signature states, and to paraphrase, don't delete code that looks like it does nothing until you are sure it doesn't. I have opened legacy scripts, spotted what appeared to be useless code, deleted it, and then tried to run it‐setting off all the alarms.

As to your comment about using strict, and while it was impossible in your situation, I find that if it is the second thing I type in my new script, after the shebang, use strict acts as a mini-debugger right from the get go. Of course, for other debugging chores use CGI::Carp; use warnings, use Data::Dumper are all indispensible. They will all help help you catch the "bleeding obvious" from the start.

Update: This popular node has some helpful tips as well.


—Brad
"Don't ever take a fence down until you know the reason it was put up. " G. K. Chesterton


Comment on Re: Looking For The Obvious - Debugging Perl
Select or Download Code
Re^2: Looking For The Obvious - Debugging Perl
by greenFox (Vicar) on Jun 22, 2004 at 03:20 UTC

    "Don't ever take a fence down until you know the reason it was put up. " G. K. Chesterton

    I agree and I am normally very hesitant about deleting or replacing someone elses code. I will sit with it and try and work out why it has been done a certain way and what I am missing, sometimes I will ask for a second opinion. I always have a backup so that reversion is no problem. In this instance though both subs were doing no more than I said and both were more comments than code.

    --
    Do not seek to follow in the footsteps of the wise. Seek what they sought. -Basho

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2014-07-31 09:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (248 votes), past polls