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

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.

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

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://368416]
[ambrus]: Yes, I was explaining him why I believe it's impossible.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2017-12-12 13:20 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (332 votes). Check out past polls.