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

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.

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.


      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, Inc.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2022-01-20 08:09 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (56 votes). Check out past polls.