Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Seeking guidance on getting better at Perl.

by kcott (Abbot)
on Aug 18, 2013 at 05:57 UTC ( #1049888=note: print w/ replies, xml ) Need Help??


in reply to Re: Seeking guidance on getting better at Perl.
in thread Seeking guidance on getting better at Perl.

While the diagnostics pragma is a useful tool for debugging, particularly when you are learning Perl, I would recommend removing, or commenting out, the use diagnostics; line in production code.

Perhaps, as a general rule-of-thumb, consider doing this at the same time that you change

$DEBUG_MODE = 1;

to

$DEBUG_MODE = 0;

and for much the same reasons.

-- Ken


Comment on Re^2: Seeking guidance on getting better at Perl.
Select or Download Code
Re^3: Seeking guidance on getting better at Perl.
by Endless (Beadle) on Aug 20, 2013 at 16:38 UTC
    Absolutely. Nice point; I don't know what Diagnostics does to your code performance. For my learning time, what is $DEBUG_MODE best used for?
      "I don't know what Diagnostics does to your code performance."

      If the messages are about problems that cause your program to abort, it obviously doesn't matter. For warning messages, you'd probably want to deal with them before code performance is an issue (i.e. prior to volume testing); so, again, it's unlikely to matter.

      You can always use Benchmark but, if you do, just be aware that generating a warning multiple times will only generate the verbose diagnostics message once. Furthermore, the time taken to get the message to your output device (I/O) is likely to far exceed the time taken to generate the message (CPU). All in all, testing diagnostics-related performance is not as straightforward as it might, at first glance, seem to be.

      "For my learning time, what is $DEBUG_MODE best used for?"

      I made up the $DEBUG_MODE variable merely to indicate whether or not the code was running in debug mode. Applications have their own ways of defining this, including: command-line options, configuration settings, variables.

      -- Ken

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-12-27 17:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls