I am almost done with my tipool implementation, and I just ran into this little thing I had left for later.
How can I do this? I am inside an XS function, and I must call a perl-land sub, no problem. But as an argument to that perl fuction I must pass a reference to the object in question. i.e. $tipool->foo() translates in: MPXS_tipool_foo(modperl_tipool_t *tp) and in there I am trying to do: PUSHMARK(sp) rv = sv_setref_pv(sv_newmortal(), "ModPerl::TiPool", (void*)tp) XPUSHs(rv); PUTBACK; retval = call_sv(...); And it works fine, creating a temporary blessed reference back to the tipool object for the perl ubroutine to play with. PROBLEM: This creates another object being referenced to, with refcnt of 1 and that object will eventually have to be destroyed, triggering more then one call to DESTROY, and leading to annoying "attempt to free unreferences scalar" Am I just to tired, or did I just miss the way to create a temporary reference to something, then throw that reference away (not leaking) without affecting the referred-to object ? I am stumped and I hope my problem makes sense ;-) tired Gozer ;-) -------------------------------------------------------------------------------- Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B) http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5 Q: It is impossible to make anything foolproof because fools are so ingenious. perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'
msg02454/pgp00000.pgp
Description: PGP signature
