[interchange] Force scalar context for is_yes and is_no
David Christensen
interchange-cvs at icdevgroup.org
Thu Sep 13 22:18:59 UTC 2012
commit 1a00958f5ab8dd8b9bb79a24dfd77e3a5482b41a
Author: David Christensen <david at endpoint.com>
Date: Thu Sep 13 17:13:16 2012 -0500
Force scalar context for is_yes and is_no
This was exposed by an obscure bug in the Vend::UserDB constructor when $opt->{cgi} was defined but
did not match the underlying regex; since it was constructed in list context this resulted in an
odd-number of hash elements.
I reviewed all uses of is_yes and is_no in the code, none of which depend on being called in array
context.
Thanks to Jeff Boes <jeff at endpoint.com> for reporting.
lib/Vend/Util.pm | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lib/Vend/Util.pm b/lib/Vend/Util.pm
index 353dc80..78099a1 100644
--- a/lib/Vend/Util.pm
+++ b/lib/Vend/Util.pm
@@ -1265,11 +1265,11 @@ sub readin {
}
sub is_yes {
- return( defined($_[0]) && ($_[0] =~ /^[yYtT1]/));
+ return scalar( defined($_[0]) && ($_[0] =~ /^[yYtT1]/));
}
sub is_no {
- return( !defined($_[0]) || ($_[0] =~ /^[nNfF0]/));
+ return scalar( !defined($_[0]) || ($_[0] =~ /^[nNfF0]/));
}
# Returns a URL which will run the ordering system again. Each URL
More information about the interchange-cvs
mailing list