summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-07-07 02:58:31 -0500
committerJesse Luehrs <doy@tozt.net>2011-07-07 02:58:31 -0500
commit139f5e738a9546ae8b6a460da7bf0c473ff55296 (patch)
tree414f4b646c7502c41c38b3fc6539f2b1e668e93b
parent0dab6d38d596535a09af16a4feba57358ca67849 (diff)
downloadsmartmatch-139f5e738a9546ae8b6a460da7bf0c473ff55296.tar.gz
smartmatch-139f5e738a9546ae8b6a460da7bf0c473ff55296.zip
undef should check the '' hash key
-rw-r--r--lib/smartmatch/engine/core.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/smartmatch/engine/core.pm b/lib/smartmatch/engine/core.pm
index c7be71f..00955d4 100644
--- a/lib/smartmatch/engine/core.pm
+++ b/lib/smartmatch/engine/core.pm
@@ -75,7 +75,7 @@ sub match {
return match([sort keys %$a], [sort keys %$b]);
}
elsif (type($a) eq 'Array') {
- return grep { defined && exists $b->{$_} } @$a;
+ return grep { exists $b->{$_ // ''} } @$a;
}
elsif (type($a) eq 'Regex') {
return grep /$a/, keys %$b;
@@ -89,7 +89,7 @@ sub match {
}
elsif (type($b) eq 'Array') {
if (type($a) eq 'Hash') {
- return grep { defined && exists $a->{$_} } @$b;
+ return grep { exists $a->{$_ // ''} } @$b;
}
elsif (type($a) eq 'Array') {
return unless @$a == @$b;