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

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

by kcott (Chancellor)
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




and for much the same reasons.

-- Ken

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

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1049888]
[1nickt]: chacham I have wanted to, and dones so, and so stated in a reply, and been roundly downvoted 2-1. (I assume for attempting to censor.)
[1nickt]: pryrt yes, I see. There is no way to differentiate without forcing to a string and all sort of weird stuff. It is enough. User 42 can get creative if s/he wishes.
[chacham]: i sent him a private message expressing my displeasure.
[1nickt]: chacham It was worse than 2-1 ! almost 4-1 !
[jdporter]: Dang. No good example of how to use IPC::Run's run() in its simplest mode?
[LanX]: him or her! ;)

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (17)
As of 2017-05-24 20:52 GMT
Find Nodes?
    Voting Booth?