On Thu, Oct 30, 2003 at 08:02:53PM +1100 Sisyphus wrote: > Nick Ing-Simmons wrote: > > > > >SV * > >my_xsub() > >CODE: > >{ > > RETVAL = sv_2mortal(newSVpv(string,strlen(string)); > >} > >OUTPUT: > > RETVAL > > > > As regards that, Nick - is the 'sv_2mortal' part necessary ? > > I thought *not* - but I'm sometimes wrong :-)
It is. If you have code like { my $var = my_xsub(); ... } and want $var to be cleaned up when it falls out of scope, you have to make it a mortal. Mortals are just variables that clean up themselves when their reference count goes to zero. Tassilo -- $_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({ pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#; $_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval