XS leakage

2011-02-24 Thread Simon Cozens
It has been altogether too long since I wrote XS code. I have some code which goes through an array and splices out a certain value: void _drop_node(HV* a, SV* activelist) { AV* newlist = newAV(); I32 i = 0; while (i = av_len((AV*)SvRV(activelist))) { SV** x =

Re: Shell-fu

2011-02-24 Thread David Cantrell
On Wed, Feb 23, 2011 at 05:32:51PM +, Marco Fontani wrote: !-M:N Lovely, thanks. -- David Cantrell | London Perl Mongers Deputy Chief Heretic Wow, my first sigquoting! I feel so special now! -- Dan Sugalski

Re: Shell-fu

2011-02-24 Thread David Cantrell
On Wed, Feb 23, 2011 at 05:48:48PM +, Smylers wrote: I very much recommend putting this in ~/.inputrc: $if Bash Space: magic-space $endif Shiny! Thanks! -- David Cantrell | Enforcer, South London Linguistic Massive More people are driven insane through religious hysteria than

Delete *really* means delete

2011-02-24 Thread Simon Wistow
I'm idly playing around with some Model type code yesterday wondering if I could make the delete method *really* delete itself. The use case I'm worried about is something like my $foo = Foo-new; ... do some stuff ... $foo-delete; # it's now gone from the database ... time passes ...

Re: Delete *really* means delete

2011-02-24 Thread Yitzchak Scott-Thoennes
rebless to a class that has an AUTOLOAD that croaks (or confesses)?

Re: Delete *really* means delete

2011-02-24 Thread Matt Lawrence
On 24/02/2011 18:35, Simon Wistow wrote: sub undef_at_underscore { $_[0] = undef; } This will remove the caller's reference to the invocant, There's no way of knowing if that's the last reference, copying will keep it alive. (my $bar = $foo)-undef_at_underscore; # $foo is still defined.

Re: Delete *really* means delete

2011-02-24 Thread Simon Wistow
On Thu, Feb 24, 2011 at 11:26:53AM -0800, Yitzchak Scott-Thoennes said: rebless to a class that has an AUTOLOAD that croaks (or confesses)? *cough* From the original mail Other suggestions were reblessing $self into 'DEAD' and then having

Re: Delete *really* means delete

2011-02-24 Thread Simon Wistow
On Thu, Feb 24, 2011 at 09:17:41PM +, Matt Lawrence said: This will remove the caller's reference to the invocant, There's no way of knowing if that's the last reference, copying will keep it alive. Yeah, that's what I think I was triggering last night. Neither of these approaches are

Re: Delete *really* means delete

2011-02-24 Thread Simon Cozens
On 24/02/2011 18:35, Simon Wistow wrote: Any other suggestions? % perl -le '$f = bless {}, Test; Internals::SvREFCNT(%$f, 1); $f-foo()' Can't call method foo on unblessed reference at -e line 1.