Stas Bekman <[EMAIL PROTECTED]> writes:
[...]
http://archive.develooper.com/[EMAIL PROTECTED]/msg96172.html
Thanks for the link!
I haven't read the whole thread, but saw Tim Bunce suggesting later in this thread not to use SvFAKE: http://archive.develooper.com/[EMAIL PROTECTED]/msg95102.html
Using SvLEN = 0 seems to be the cleanest solution. Unfortunately,
setting SvLEN = 0 prevents correct sv_2iv conversion w/ 5.8. The bug is caused by testing for SvLEN > 0 instead of SvCUR > 0 in Perl_sv_2iv. I don't know if bleadperl has fixed this, but it's probably behaved this way for quite a while.
Please perlbug this to p5p.
May be all you need is to manipulate the pointers. So in normal case SVPV will point to the first char, in apreq case it'll point to the char the real data starts from. Am I shooting far off the target?
In the normal case:
sv = newSVpv(data,0);
perl mallocs space for a copy and does a strcpy(SvPVX(sv), data). That's not good enough for apreq- we really need SvPVX(sv) == data in order to get at the metadata in front of &data[0].
The real problem is that it's probably a bad idea to rely on non-public APIs, since these behaviors can change at will. Perhaps after all, using either a sub-class, or an optional callback will be a more robust solution.
Besides that, once SvFAKE what happens if users try to modify it?
SvFAKE | SvREADONLY is what perl uses to mark shared sv's, so I thought I could borrow those flags here. Unfortunately that doesn't seem to work very well with the tiehash table API (t/modperl/env generates lots of "Attempt to free non-existent shared string ..." warnings).
And isn't all this stuff quite new in 5.8, and doesn't really work with 5.6?
Still, once user tries to modify the data, what happens to meta-data? When COW is performed, does it copy the whole thing or just whatever was pointed by SvCUR?
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
