Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Reverting the internals of an IV to their original statesby syphilis (Archbishop) |
on Dec 27, 2021 at 04:19 UTC ( [id://11139925]=perlquestion: print w/replies, xml ) | Need Help?? |
syphilis has asked for the wisdom of the Perl Monks concerning the following question:
Hi, As revealed in this demo by Devel::Peek::Dump(), calling foo($sv) can make significant alterations to the internals of $sv: Inside that XS sub foo() is there a simple way that, having called SVPV_nolen(), the internals of the provided argument can be restored to the states they held just prior to the calling of foo($sv) ? Inclusion of the commented-out C-code in foo() goes some way to doing that ... but not all the way. It will change the second Dump() to: That looks about right except that the SV is still PVIV, and the PV slot, although cleared, is still being displayed. Perhaps the PV slot is being displayed simply because the SV is PVIV, and the solution lies in getting the "PVIV" to revert to "IV". Cheers, Rob
Back to
Seekers of Perl Wisdom
|
|