in reply to XS: SvPVLV examples?

I grep the perl source, 0 hits, must not exist :)

Replies are listed 'Best First'.
Re^2: XS: SvPVLV examples?
by BrowserUk (Patriarch) on Sep 24, 2009 at 03:17 UTC

    Try grepping for just "PVLV". I find 10 hits in sv.h and 11 in sv.c

    What I haven't found, is a clear example of allocating one and setting it up properly. I've tried to reverse engineer it based mostly upon the PerlGuts description and what I can glean from the Devel::Peek output, but so far without success.

    use Devel::Peek qw[ Dump ];; Dump \substr 'fred', 1, 2;; SV = RV(0x78148) at 0x78138 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x3d39898 SV = PVLV(0xf3758) at 0x3d39898 REFCNT = 2 FLAGS = (PADMY,GMG,SMG,pPOK) IV = 0 NV = 0 PV = 0x3e5eda8 "re"\0 CUR = 2 LEN = 8 MAGIC = 0x3e75af8 MG_VIRTUAL = &PL_vtbl_substr MG_TYPE = PERL_MAGIC_substr(x) TYPE = x TARGOFF = 1 TARGLEN = 2 TARG = 0x3d39f58 SV = PV(0x3e25950) at 0x3d39f58 REFCNT = 2 FLAGS = (PADTMP,POK,READONLY,pPOK) PV = 0x3e5ece8 "fred"\0 CUR = 4 LEN = 8

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.