in reply to Garbage collected class attributes with inside out classes.

I would reference count and put a closure around my $counter.

Be well
rir

  • Comment on Re: Garbage collected class attributes with inside out classes.

Replies are listed 'Best First'.
Re^2: Garbage collected class attributes with inside out classes.
by kyle (Abbot) on Mar 02, 2007 at 03:02 UTC

    This sounds simple, but I still don't know what you mean. Could you show code for this?

      Just that I'd limit the counter variable to the routines that need it; so it seems that the variable doesn't exist in parts of your class that are outside the scope created by the outermost brackets below.
      { my $count; # Number of class instances that exist. sub BUILD { ++$count; # } sub DEMOLISH { --$count; # } }
      Be well,
      rir