summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-07-07 03:30:56 -0500
committerJesse Luehrs <doy@tozt.net>2011-07-07 03:30:56 -0500
commit2c9613c69eded089c42a83d96a2f518d8f2eed83 (patch)
tree81abccac3b079d0de86879f565d0a4e07ae1e39f
parent080e26520786d5a07f603698ea31057a26a73ed2 (diff)
downloadsmartmatch-engine-rjbs-2c9613c69eded089c42a83d96a2f518d8f2eed83.tar.gz
smartmatch-engine-rjbs-2c9613c69eded089c42a83d96a2f518d8f2eed83.zip
stop taking a shortcut here, it's wrong (for non-string keys)
-rw-r--r--lib/smartmatch/engine/core.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/smartmatch/engine/core.pm b/lib/smartmatch/engine/core.pm
index 27a5c92..a3c96b9 100644
--- a/lib/smartmatch/engine/core.pm
+++ b/lib/smartmatch/engine/core.pm
@@ -72,7 +72,13 @@ sub match {
}
elsif (type($b) eq 'Hash') {
if (type($a) eq 'Hash') {
- return match([sort keys %$a], [sort keys %$b]);
+ my @a = sort keys %$a;
+ my @b = sort keys %$b;
+ return unless @a == @b;
+ for my $i (0..$#a) {
+ return unless $a[$i] eq $b[$i];
+ }
+ return 1;
}
elsif (type($a) eq 'Array') {
return grep { exists $b->{$_ // ''} } @$a;