diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-05-08 22:37:03 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-05-08 22:37:03 +0200 |
commit | 6d743019f3ff1c2efcf74a1e4f98ea5bd3b7351a (patch) | |
tree | 0789c3863bdd0915e2532954c23eb5a7c886204b /pp_ctl.c | |
parent | 031a44ed339cfee9d4b2bc19abf15fa19412c9fd (diff) | |
download | perl-6d743019f3ff1c2efcf74a1e4f98ea5bd3b7351a.tar.gz |
Make ~~ overloading only be invoked on the right argument
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -4006,7 +4006,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) # 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; @@ -4039,8 +4039,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) 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 */ |