in reply to Re: Do people find warning for undef with string compare useful?
in thread Do people find warning for undef with string compare useful?
How would that not apply to: $a and $b and $c -- as a quick way to check for that all are defined -- but it gives you no warning if $b=undef vs. $b='';
I don't see how the eq case is any more helpful than the logical-only operators..?
I just think of the amount of code out there that is written to avoid those warnings. Sure was a nice excuse for writing a replacement for Printf/sprintf/say that auto handles undef as args to a format by inserting 'undef' in the output - which I find alot less intrusive than a warning which, due to my own conventions, usually results in termination with traceback!... Don't many of us treat warnings as errors?
I guess, personally, since my print's are all auto checked, I usually see undefs in debug and error statements -- though honestly, if someone gets a warning in their code over an undef, what that meand is that they didn't write code to check the value before making that comparison. How many such warnings are needed to get people to always program in checks where things possibly can be undef?
Any value that can be undef -- *will* (eventually)...it's like a Murphism...;-)
Relying on the warning to tell you that you left out a check doesn't seem real reliable, as there are alot of cases where no warning is given.
But if people don't see that here, it sounds like we are stuck with it for the nonce....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Do people find warning for undef with string compare useful?
by vsespb (Chaplain) on Jun 01, 2013 at 11:06 UTC | |
by perl-diddler (Chaplain) on Jun 01, 2013 at 15:18 UTC | |
by vsespb (Chaplain) on Jun 01, 2013 at 15:28 UTC | |
by perl-diddler (Chaplain) on Jun 02, 2013 at 05:24 UTC | |
by perl-diddler (Chaplain) on Feb 11, 2014 at 21:47 UTC | |
|
Re^3: Do people find warning for undef with string compare useful?
by Laurent_R (Canon) on Jun 01, 2013 at 21:17 UTC |