develooper Front page | perl.perl5.porters | Postings from April 2003

COW in CORE and SvFAKE in older Perl

Thread Next
From:
Aaron Sherman
Date:
April 29, 2003 08:08
Subject:
COW in CORE and SvFAKE in older Perl
Message ID:
1051628849.16490.551.camel@localhost.localdomain
I came across this message:

http://archive.develooper.com/perl5-porters@perl.org/msg85292.html

Much to my chagrin, I have not been following p5p (even though I'm on
the list), and wanted to ask about the copy-on-write changes.

I'm in the middle of writing a module that I thought would address some
SpamAssassin performance problems (or at least provide me with the
platform to address them) by creating SvFAKE values based on a substring
of original string (a "shard" as I've been referring to it) without
allocating new memory and/or copying.

However, support for SvFAKE in 5.6.1 seems to be very limited (in fact,
it's really only working if you are SvFAKEing an SVt_PVGV, and even then
I'm not sure how general-purpose it is). This is unfortunate because it
seems to mean that I have to resort to MAGIC in order to prevent Perl
from trying to free my data (I've already marked it as SvREADONLY).

Of course, I was expecting to run into the hordes of problems that would
creep up because my strings were not internally nul-terminated, but I
never got that far.

So, on to my questions...

In later versions, is SvFAKE more fully supported for arbitrary SVt_PV*
types?

I'd love to make these suckers COW instead of READONLY where supported,
is COW going to be the default in the future?

Is there any way (say, back to 5.6.0) that this sort of thing is
generally done without invoking magic, and I've just missed it, or am I
going to have to bite that bullet?

Thank you all!


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About