RE: PerlHack - Adding new flag into a SV

2004-04-27 Thread Orton, Yves
Title: RE: PerlHack - Adding new flag into a SV From: Orton, Yves [EMAIL PROTECTED] I thought you are just automagicaly weaken()ing the referenced stored in the tied hash??? Something like package Hash::NoRef; use Scalar::Util qw(weaken); require Tie::Hash; @ISA =

Re: PerlHack - Adding new flag into a SV

2004-04-27 Thread Adrian Howard
On 27 Apr 2004, at 13:01, Orton, Yves wrote: [snip] No but I can describe one that would. Imagine a binary tree. We store each node using weakrefs in the structure you describe. Now I search and find an internal node of the tree. The root of the tree falls out of scope, essentially stripping the

Re: PerlHack - Adding new flag into a SV

2004-04-27 Thread Sam Vilain
No, weakrefs cast backref magic onto their target to avoid this problem. When the reference count drops to zero the magic ensures that the weakref is set to undef. See Perl_sv_rvweaken() in sv.c for more. Sam. Orton, Yves wrote: From: Orton, Yves [EMAIL PROTECTED] I thought you are just