we probably hit code like this
Assuming that probably things are going to happen always is a recipe for disaster.
Your implementation of decrease_salary seems plausible, but it is not the only one. In order to ensure that you are handling "unknown" values right you will be forced to examine it, and even then, this is not perfectly safe, because somebody may rewrite that function in the future without noticing that subtle dependency.
IMO, the only unknown value that makes sense is one that croaks when used as part of any operation (including comparisons) and that has to be explicitly checked with is_unknown.
Or you can just use...
use warnings FATAL => 'uninitialized';
though, this will not cross lexical scopes, so I can still see value on having a magic unknown value.
Re^3: "undef" is not NULL and what to do about it
Select or Download Code
Replies are listed 'Best First'.
|Re^4: "undef" is not NULL and what to do about it|
by Ovid (Cardinal) on Feb 21, 2013 at 14:44 UTC