# define SM_SEEN_OTHER(sv) hv_exists_ent(seen_other, \
sv_2mortal(newSViv(PTR2IV(sv))), 0)
- if (SvAMAGIC(d) || SvAMAGIC(e)) {
+ if (SvAMAGIC(e)) {
SV * const tmpsv = amagic_call(d, e, smart_amg, 0);
if (tmpsv) {
SPAGAIN;
RETPUSHYES;
}
- if ((sv_isobject(d) && (SvTYPE(SvRV(d)) != SVt_REGEXP))
- || (sv_isobject(e) && (SvTYPE(SvRV(e)) != SVt_REGEXP)))
+ if (sv_isobject(e) && (SvTYPE(SvRV(e)) != SVt_REGEXP))
Perl_croak(aTHX_ "Smart matching a non-overloaded object breaks encapsulation");
/* ~~ sub */
use strict;
use warnings;
-use Test::More tests => 124;
+use Test::More tests => 118;
# The behaviour of the feature pragma should be tested by lib/switch.t
# using the tests in t/lib/switch/*. This file tests the behaviour of
{ package OverloadTest;
use overload '""' => sub{"string value of obj"};
+ use overload 'eq' => sub{"$_[0]" eq "$_[1]"};
use overload "~~" => sub {
my ($self, $other, $reversed) = @_;
default {$matched = 0}
}
- is($obj->{called}, 1, "$test: called");
- ok($matched, "$test: matched");
- is($obj->{left}, "string value of obj", "$test: left");
- is($obj->{right}, "other arg", "$test: right");
- ok(!$obj->{reversed}, "$test: not reversed");
+ is($obj->{called}, 0, "$test: called");
+ ok(!$matched, "$test: not matched");
}
{
when ("other arg") {$matched = 1}
}
- is($obj->{called}, 1, "$test: called");
+ is($obj->{called}, 0, "$test: called");
ok(!$matched, "$test: not matched");
- is($obj->{left}, "string value of obj", "$test: left");
- is($obj->{right}, "other arg", "$test: right");
- ok(!$obj->{reversed}, "$test: not reversed");
}
{