__UNDEFINED__

__UNDEFINED__ SvMAGIC_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END

#if { VERSION < 5.9.3 }

__UNDEFINED__ SvPVX_const(sv) ((const char*) (0 + SvPVX(sv))) __UNDEFINED__ SvPVX_mutable(sv) (0 + SvPVX(sv))

__UNDEFINED__ SvRV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END

#else

__UNDEFINED__ SvPVX_const(sv) ((const char*)((sv)->sv_u.svu_pv)) __UNDEFINED__ SvPVX_mutable(sv) ((sv)->sv_u.svu_pv)

__UNDEFINED__ SvRV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ ((sv)->sv_u.svu_rv = (val)); } STMT_END

#endif

__UNDEFINED__ SvSTASH_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END

#if { VERSION < 5.004 }

__UNDEFINED__ SvUV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END

#else

__UNDEFINED__ SvUV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END

#endif

IV TestSvUV_set(sv, val) SV *sv UV val CODE: SvUV_set(sv, val); RETVAL = SvUVX(sv) == val ? 42 : -1; OUTPUT: RETVAL

IV TestSvPVX_const(sv) SV *sv CODE: RETVAL = strEQ(SvPVX_const(sv), "mhx") ? 43 : -1; OUTPUT: RETVAL

IV TestSvPVX_mutable(sv) SV *sv CODE: RETVAL = strEQ(SvPVX_mutable(sv), "mhx") ? 44 : -1; OUTPUT: RETVAL

void TestSvSTASH_set(sv, name) SV *sv char *name CODE: sv = SvRV(sv); SvREFCNT_dec(SvSTASH(sv)); SvSTASH_set(sv, (HV*) SvREFCNT_inc(gv_stashpv(name, 0)));

my $foo = 5; ok(&Devel::PPPort::TestSvUV_set($foo, 12345), 42); ok(&Devel::PPPort::TestSvPVX_const("mhx"), 43); ok(&Devel::PPPort::TestSvPVX_mutable("mhx"), 44);

my $bar = [];

bless $bar, 'foo'; ok($bar->x(), 'foobar');

Devel::PPPort::TestSvSTASH_set($bar, 'bar'); ok($bar->x(), 'hacker');

package foo;

sub x { 'foobar' }

package bar;

sub x { 'hacker' }

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 12:

Unknown directive: =provides

Around line 16:

Unknown directive: =implementation

Around line 60:

Unknown directive: =xsubs

Around line 97:

Unknown directive: =tests