http://www.perlmonks.org?node_id=482883


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.

Replies are listed 'Best First'.
Re^2: On Commenting Out 'use strict;'
by salva (Canon) 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.