Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: On Commenting Out 'use strict;'

by jonadab (Parson)
on Aug 11, 2005 at 09:59 UTC ( #482883=note: print w/ replies, xml ) Need Help??


in reply to Re^2: On Commenting Out 'use strict;'
in thread On Commenting Out 'use strict;'

I think it's a little worse than that. There are a couple of warnings in Perl5 that frequently get triggered without any real problem in the code. I'm thinking most especially of the one when you interpolate a value that might or might not be defined, and it happens not to be. I have never yet once seen a situation where that warning was useful, but many, many times I have found myself introducing excessive verbosity and needless complexity to the code in order to suppress it.

I've also occasionally been annoyed by other warnings when I knew very well about the thing they were warning about but for one reason or another did not consider it a problem, and I wished I could just make the warning shut up.

I heard a rumor that Perl6 is going to give us the ability to shut off individual warnings, without losing the ability to see other warnings. I look forward to that.

Nevertheless, the clown described in the original post is making future trouble for himself and/or someone else.


Comment on Re: On Commenting Out 'use strict;'
Re^2: On Commenting Out 'use strict;'
by salva (Monsignor) on Aug 11, 2005 at 10:08 UTC
    I heard a rumor that Perl6 is going to give us the ability to shut off individual warnings, without losing the ability to see other warnings.

    You can actually do that on Perl 5:

    use warnings; ... # and then deep on your code { ... no warnings 'uninitialized'; # or whatever print "$uninitialized_var\n"; ... }
      Just to shine a little more light on it: perllexwarn. Search for 'Category Heirarchy' if you want to see all of the categories.

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come

        And then, if you want to turn off a warning but don't know to which category it belongs, take a look at perldiag.
Re^2: On Commenting Out 'use strict;'
by Codon (Friar) on Aug 12, 2005 at 23:06 UTC

    I have run into more than one situation in maintaining code (one other developer, specifically) that started throwing a lot of warnings when he turned on warnings where the warning was quite useful. This person found that the best way to get rid of these "useless" "unitialized" warnings was to pipe his error logs through grep -v uninitialized. (He was not at the company six months later.) When I went into the code, I found that he was testing against a typoed hash key. This was a subtle bug that was not discovered for *YEARS* until warnings were turned on.

    Ivan Heffner
    Sr. Software Engineer, DAS Lead
    WhitePages.com, Inc.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-09-17 10:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (72 votes), past polls