$x = {
key0 => {
a => var1,
b => var2,
},
and so on.
####
hv_store(dusr,"C",1,newSVuv(1),0);
hv_store(dusr,"B",1,newSVuv(len),0);
hv_store(dusr,"E",1,newSVuv(now),0);
hv_store(dusr,"T",1,newSVuv(0),0);
####
if ((fetch_uv(dusr,"T")) < now) {
dSP;
PUSHMARK(SP);
# trgt.s is the key for HV * dusr
XPUSHs(sv_2mortal(newSVpv(trgt.s,4)));
PUTBACK;
call_sv(myperlsub,G_VOID);
}
in the perl routine, this instruction is executed
$x->{trgt}->{T} = 12345;
upon return from the perl call_sv, examination of the contents of the sub hash
vpp = hv_fetch(hp,trgt.s,1,0);
value = SvUVX(*vpp);
reveals that the contents appear to contain the initalization value rather than 12345.
HOWEVER, if the hash is iterated
for(itmp = 0; itmp < iend;itmp++) {
he = hv_iternext(dusr);
ctmp = hv_iterkey(he,&rtmp);
ttmp = SvUV(hv_iterval(dusr,he));
fprintf(stderr,"key %s => %d\n",ctmp,ttmp);
}
The correct value magically appears
####
SV = IV(0x8380458) at 0x83b70d8
REFCNT = 1
FLAGS = (IOK,pIOK,IsUV)
UV = 0
When the perlsub updates the data it is conveted
to an NV
SV = PVNV(0x8284298) at 0x83b70d8
REFCNT = 1
FLAGS = (NOK,pNOK)
IV = 0
NV = 12345
PV = 0