Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: RFC: Tutorial: use strict; now what!?

by Eliya (Vicar)
on Feb 08, 2012 at 15:10 UTC ( #952517=note: print w/replies, xml ) Need Help??


in reply to RFC: Tutorial: use strict; now what!?

now what!?

use warnings;  :)

Seriously, I was a bit surprised to see no mention of warnings whatsoever.   Sure, you don't have to treat everything in a single tutorial, but if this is targeted at newcomers, recommending strict's equally helpful companion wouldn't do any harm, IMHO.

Replies are listed 'Best First'.
Re^2: RFC: Tutorial: use strict; now what!?
by educated_foo (Vicar) on Feb 08, 2012 at 16:49 UTC
    Unlike strict, which is sometimes helpful and almost never harmful, warnings is very much a mixed bag, "use of uninitialized value" being the most obvious example of its harmfulness. Making it genuinely useful requires a lot of work (see e.g. common::sense), and most people aren't willing to put in that much effort. Lumping strict and warnings together is a mistake.
      Lumping strict and warnings together is a mistake.

      I beg to disagree.  Many times (not only here, but at my workplace, too) I've seen people hunting for bugs for way too long, simply because they thought "I don't need no stinking warnings".  Had they had them enabled, they would have been pointed to the root cause of the problem more or less directly.   And if you feel annoyed by the "use of uninitialized value"s (and you know what you're doing), it's no big deal to disable those specifically with no warnings "uninitialized"; — at least that doesn't qualify as "a lot of work" in my opinion.

      I agree there are rare circumstances where you don't want them — for example, I've seen a few cases (very few actually) where leaving warnings enabled in production environments has led to more problems than it solved — but as a development tool, I'd always recommend use warnings;

        The solution is pretty simple: if your code isn't doing what you expect, run it with "perl -w". This may point to your error (along with a bunch of other non-errors); if it does, you can fix it and move on without having to contort your code to placate warnings.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://952517]
help
Chatterbox?
[james28909]: what i am trying to do is track state of a chat based application. i need to be able to store the channels and such for a user, and when they join a new server/channel i need to be able to update that feild.
[james28909]: do you think OO would best suite that?
[karlgoethebier]: james28909: The last two are not mainstream. You have been warned ;-)
[karlgoethebier]: james28909: I don't know. Try it.
[james28909]: foreach server this bot is on, the gateway sends me a json response, which i parse out all the info with JSON, and this response has user information, i need to be able to add a user, and then update the user info when they join/leave rooms ect

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2017-05-25 16:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?