in reply to Tracking objects.
package Dog ; use Hash::NoRef ; use vars qw(%GHOST_TABLE) ; tie(%GHOST_TABLE , 'Hash::NoRef') ; my $GHOST_ID ; sub new { my $class = shift ; my $this = bless( {} , $class ) ; ++$GHOST_ID ; $GHOST_TABLE->{$GHOST_ID} = $this ; return $this } package main ; { my $obj = new Dog() ; print $GHOST_TABLE->{1} ; ## will show the object reference } print $GHOST_TABLE->{1} ; ## will show undef
|
|---|