From 2c9613c69eded089c42a83d96a2f518d8f2eed83 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 7 Jul 2011 03:30:56 -0500 Subject: stop taking a shortcut here, it's wrong (for non-string keys) --- lib/smartmatch/engine/core.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3