diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-07-07 03:30:56 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-07-07 03:30:56 -0500 |
commit | 2c9613c69eded089c42a83d96a2f518d8f2eed83 (patch) | |
tree | 81abccac3b079d0de86879f565d0a4e07ae1e39f /lib | |
parent | 080e26520786d5a07f603698ea31057a26a73ed2 (diff) | |
download | smartmatch-engine-core-2c9613c69eded089c42a83d96a2f518d8f2eed83.tar.gz smartmatch-engine-core-2c9613c69eded089c42a83d96a2f518d8f2eed83.zip |
stop taking a shortcut here, it's wrong (for non-string keys)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/smartmatch/engine/core.pm | 8 |
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; |