[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] not defined $bucket || $bucket eq '???'
Oops. Hit a subtle bug in my code today because || considers '' true.
Be careful out there... :)
j
Index: Model/eWin/Transactions.pm
===================================================================
--- Model/eWin/Transactions.pm (revision 3467)
+++ Model/eWin/Transactions.pm (working copy)
@@ -108,7 +108,7 @@
my $amount = $pms->{$tran_code};
$sth->execute($property, $tran_code);
my ($bucket) = $sth->fetchrow;
- if (not defined $bucket || $bucket eq '???') {
+ if (not defined $bucket or $bucket eq '???') {
$self->_complain_via_email($property, $tran_code, $crs);
$bucket = '???';
}
Bug demonstrated in the debugger. :)
DB<19> p $bucket
???
DB<20> x (not defined $bucket || $bucket eq '???')
0 ''
DB<21> x (not defined $bucket or $bucket eq '???')
0 1