Just another Perl shrine | |
PerlMonks |
Re^2: Inline::C callbacks to Perlby Animator (Hermit) |
on Nov 11, 2005 at 21:40 UTC ( [id://507874]=note: print w/replies, xml ) | Need Help?? |
I agree with what [id://liverpole] is saying. What is happening is that the SV that is holding the reference gets destroyed. Storing it in a variable leads to the same problem. (When the variable goes out of scope that is). The proper way to prevent this from happening is to increase the reference counter of the code-SV. (Since that will prevent the reference counter of the (temp) variable to become 0. Meaning Perl won't destroy it.) (You can do this by using SvREFCNT_inc(code);. You can read more about the function/macro in perlapi) Update: changed wording
In Section
Seekers of Perl Wisdom
|
|