By the way, using a string buffer to store a pointer is a waste. An IV is guaranteed to be big enough.
I think the reason people place pointers into the string buffer of the PV is to circumvent perl's overzealous CLONEing code from messing with it.
If you try RV->pointer_to_non_SV, you cannot bless the RV because perl check what is pointed at.
If you try RV->SvUV->pointer_to_nonSV, you can bless the Rv, but when CLONE gets it hands on it, it not only clones the RV and the SvUV, but because the SvUVs are aliased for SvRVs, it also assumes that the value in the SvUV is an SV* and clones that also. At least that is what seems to happen?
By going the RV->SvPV->string(containing pointer_to_non_SV), CLONE does expect the string to contain a pointer and so copies the original string value verbatim.
It is a messy roundabout route, but I don't see a viable alternative? And even that doesn't seem to work properly.
Grr. Why is none of this shit documented? Where are the people that know how this stuff works?
In reply to Re^4: semi-panic: attempt to dup freed string?
by BrowserUk
in thread semi-panic: attempt to dup freed string?
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |