Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Is it me?

by chas (Priest)
on Sep 14, 2005 at 18:22 UTC ( [id://491958]=note: print w/replies, xml ) Need Help??


in reply to Is it me?

If a script is developed (using strict and warnings), and is considered complete and working as expected, is there a reason to leave the use strict (or warnings) turned on? I suppose it doesn't hurt and could be useful for someone else who might edit the script, but other than the latter possibility, I'm really not sure.
chas

Replies are listed 'Best First'.
Re^2: Is it me?
by perrin (Chancellor) on Sep 14, 2005 at 20:15 UTC
    Most of the time, you don't get 100% coverage when you test things. That means there might still be a situation where something unexpected goes wrong, and a useful warning helps you track down what it was.
Re^2: Is it me?
by tcf03 (Deacon) on Sep 14, 2005 at 18:32 UTC
    I would leave them there as well, if for nothing else than the general sense of good Perl style they advocate.

    Ted
    --
    "That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
      --Ralph Waldo Emerson
Re^2: Is it me?
by jacques (Priest) on Sep 14, 2005 at 18:24 UTC
    Well, in that case, you would want to keep them in there since programs are almost never "complete" including your own.
Re^2: Is it me?
by QM (Parson) on Sep 15, 2005 at 18:54 UTC
    ...is there a reason to leave the use strict (or warnings) turned on?
    Flip that around -- why would you turn it off? If you can't justify turning it off, then it should stay on.

    Brainstorming here, possible reasons to turn strict and warnings off:

    Speed: Not performing all of those compile- and run-time checks is bound to improve speed. Only benchmarking will tell if it's a real gain or not.

    Confusing users with warning messages: If code spits out warning messages, it should be for a good reason, and it should be meaningful to the user. For example, if the file doesn't exist, that's something the user should understand. If the Beeblebrox is in Ratzafratza, then maybe the message should be changed to something like:

    The Beeblebrox is in Ratzafratza. This should never happen. Please contact the maintainer of this script.
    If your code sometimes innocuously spits out warnings that you know don't make any difference, for maintenance reasons you are better off to use no warnings around the offending statement, rather than turn off warnings everywhere.

    Laziness: OK, I'm not sure how this would apply.

    Hubris: Umm, I'm really not sure how this would apply.

    Any others?

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

Re^2: Is it me?
by exussum0 (Vicar) on Sep 15, 2005 at 15:30 UTC
    Leave it in. People forget to put it in, turn it on, flip the switch and diddle the nob. It doesn't really impact performance beyond negligible.

    Lord knows how many time I've forgotten nuances and rules of things to check when things break. When things aren't working right, make it obvious. Use strict.

    (paid for by the strict.pm party. strict.pm for prez, 2008!)

    ----
    Give me strength for today.. I will not talk it away.. Just for a moment..
    It will burn through the clouds.. and shine down on me.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-28 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found