Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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

In reply to Re: use warnings and debug messages by GrandFather
in thread use warnings and debug messages by szabgab

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (8)
As of 2024-04-18 21:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found