Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: When should you not use strict and warnings?

by blue_cowdawg (Monsignor)
on Dec 28, 2012 at 23:44 UTC ( #1010765=note: print w/replies, xml ) Need Help??

in reply to When should you not use strict and warnings?

      I'd like to invite Perl Monks to elucidate on when use strict; and use warnings; should NOT used.

Here at the Blue Cowdawg Perl Coding Ranch not using strict and warnings is considered a hanging offense.

I cannot think of any reason why I would not use them, even in a production environment. When Operations calls me at oh-dark-hundred to tell me that something isn't working the first thing I'm going to do is check logs to see if the script has puked up anything. While strict and warnings are particularly useful for catching compile time issues, warnings in particular can catch other issues. Such as? Let me paint a vignette for you:

Global Operations: The FTP push for Acme Plumbing and Booby Traps LLC has stopped working. The customer is complaining that he hasn't seen reports since ten hours ago.
Me: Hang on a sec... clikety clickety clickety OH! The customer file store isn't mounted any more... clickety! click! Should be good to go now.

While that's a bad example of why warnings helped out, the problem was located when the logs were checked and the opendir call failed and was noted. (I don't use die in my production code I have my own function that does the same thing, but logs to a file instead of stdout/stderr) </p.

A better example of how warnings helped would be in a CGI that had multiple hands involved. A module that my code depended on was modified by its author. The return values from that module's methods (subs) had changed and the author neglected to warn anybody. My code (via warnings) started complaining about uninitialized values which were duly logged in the Apache logs.

Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Replies are listed 'Best First'.
Re^2: When should you not use strict and warnings?
by Anonymous Monk on Dec 28, 2012 at 23:47 UTC
    But smoking crack is fine?

      just turn your humor circuit on. :-)

      Peter L. Berghold -- Unix Professional
      Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
        Drugs are bad, mkay?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010765]
[ELISHEVA]: well then since the obvious possible mistakes on my part have been ruled out, SOPW it is.
[ELISHEVA]: the data source, or one of them, is the OECD - they provide a *lot* of data that ought to be easily available to perl programmers.
[erix]: it might be cunning to mention the module in the title... :)
[ELISHEVA]: fancy that - a title that actually describes the problem :-)
[ELISHEVA]: but actually thanks for the reminder
[Discipulus]: DBI::CSV + utf8 = BOO?M
[erix]: in extremis we tend to forget stuff ;)
[ELISHEVA]: \Disciplus : lol
[Discipulus]: and ELISHEVA we waait one your post since ~2years... ;=)
[ELISHEVA]: has it really been that long?

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