Created
May 24, 2017 18:04
-
-
Save dur-randir/a657b1294c133ef8a3c93651534c1858 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Z; | |
use Devel::Peek (); | |
use overload "+"=>sub {42}; | |
die "fail" unless 42 == bless({}) + 1; | |
Devel::Peek::Dump \%Z::; | |
use Inline C => <<END; | |
void foo(SV* targ) { | |
if (!SvOK(targ)) return; | |
if (SvROK(targ)) targ = SvRV(targ); | |
if (SvMAGICAL(targ) && mg_find(targ, PERL_MAGIC_overload_table)) { | |
warn("sv_unmagic"); | |
sv_unmagic(targ, PERL_MAGIC_overload_table); | |
} | |
} | |
END | |
foo(\%Z::); | |
Devel::Peek::Dump \%Z::; | |
die "fail" unless 42 == bless({}) + 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment