in reply to Re: Class DBI and reference counting
in thread Class DBI and reference counting

I acutally tried weaken before posting:
sub flagged2 { my $self =shift ; unless(defined($self->{f})) { my @bs = $self->bs( flag => 1 ) ; $self->{f} = weaken(shift @bs) ; } return $self->{f} ; }
The problem is on the first call to the function it works as expected, but the second time it's called the object has already gone out of scope and been destroyed resulting in an undefined value returned.