From 1172d8b556c93d35aff699eadfc10f93296d7319 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 7 Jul 2011 08:54:59 -0500 Subject: reimplement the buggy behavior for now --- lib/smartmatch/engine/core.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/smartmatch/engine/core.pm b/lib/smartmatch/engine/core.pm index a3c96b9..e172b6c 100644 --- a/lib/smartmatch/engine/core.pm +++ b/lib/smartmatch/engine/core.pm @@ -55,6 +55,16 @@ sub match { } elsif (type($b) eq 'Object') { my $overload = overload::Method($b, '~~'); + + # XXX this is buggy behavior and may be changed + # see http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2011-07/msg00214.html + if (!$overload && overload::Overloaded($b)) { + $overload = overload::Method($a, '~~'); + die "no ~~ overloading on $b" + unless $overload; + return $a->$overload($b, 0); + } + die "no ~~ overloading on $b" unless $overload; return $b->$overload($a, 1); -- cgit v1.2.3