diff options
author | Vincent Pit <perl@profvince.com> | 2008-05-01 14:45:51 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-05-02 11:07:19 +0000 |
commit | e67b97bd974194ad616acbb7813c5631aacd6be7 (patch) | |
tree | e32b15786d8137b66c0931484bcaab84464780b7 /pp_ctl.c | |
parent | aa472d819afa513557c8ae076693d2c753998ed1 (diff) | |
download | perl-e67b97bd974194ad616acbb7813c5631aacd6be7.tar.gz |
~~ with non-overloaded objects
From: "Vincent Pit" <perl@profvince.com>
Message-ID: <63496.92.128.104.139.1209638751.squirrel@92.128.104.139>
p4raw-id: //depot/perl@33777
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -4012,6 +4012,11 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) && (Other = d)) ) +# define SM_OBJECT ( \ + (sv_isobject(d) && (SvTYPE(SvRV(d)) != SVt_REGEXP)) \ + || \ + (sv_isobject(e) && (SvTYPE(SvRV(e)) != SVt_REGEXP)) ) \ + # define SM_OTHER_REF(type) \ (SvROK(Other) && SvTYPE(SvRV(Other)) == SVt_##type) @@ -4043,6 +4048,9 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) if (SvGMAGICAL(e)) e = sv_mortalcopy(e); + if (SM_OBJECT) + Perl_croak(aTHX_ "Smart matching a non-overloaded object breaks encapsulation"); + if (SM_CV_NEP) { I32 c; |