Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: use warnings and debug messages

by GrandFather (Saint)
on Mar 07, 2017 at 20:26 UTC ( [id://1183882]=note: print w/replies, xml ) Need Help??


in reply to use warnings and debug messages

If the nature of the debug statements really is of the nature of debug("x='%s' y='%s'", $x, $y); then throw away your debug statements and invest in a decent IDE instead. With an IDE you don't need to decide up front what you need to dump - just set a break point and inspect anything that looks interesting. Then you can follow an interesting train of execution in one hit or even alter the variable's value to check following code does the right stuff. Much better than stopping execution, adding and removing debug statements and rerunning the code followed by an intense session of wading through pages of output using Sherlock level detective skills to try and determine what went on.

I almost never use debugging prints. I sometimes add a chunk of conditional code that I can set a break point on. I always have strictures turned on, even for "one line" trivial code.

Mind you, the example you use causes flashing red lights and alarm bells to go off when I read it. Declaring $y without initializing it is almost always an error. Rather than sweep those errors under the carpet by turning off warnings it would be better to get an intern to find all those cases and either make obvious fixes or flag them for intervention by a higher authority. Some of those intervention cases are going to make the whole exercise worth while!

Premature optimization is the root of all job security

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found