sub DESTROY { my ($self) = @_; my $id = ID($self); push @_, $id; print "here we are in DESTROY\n"; DEMOLISH: for my $base_class (_hierarchy_of(ref $_[0])) { no strict 'refs'; print "destroying $base_class\n"; # no warnings 'once'; if (my $demolish_ref = *{$base_class.'::DEMOLISH'}{CODE}) { print "about to call destroy on $base_class\n"; &{$demolish_ref}; } for my $attr_ref ( @{$attribute{$base_class}} ) { delete $attr_ref->{ref}{$id}; } } } #### here we are in DESTROY destroying MyClass Name "MyClass::DEMOLISH" used only once: possible typo at Class/Std.pm line 528. here we are in DESTROY destroying MyClass #### package MyClass; use strict; use warnings; use Class::Std; my $hash_ref = {}; bless $hash_ref, 'MyClass'; my $hash_ref2 = {}; bless $hash_ref2, 'MyClass'; 1; #### here we are in DESTROY destroying MyClass here we are in DESTROY destroying MyClass here we are in DESTROY destroying MyClass #### package MyClass; use strict; use warnings; use Class::Std; my $hash_ref = {}; #bless $hash_ref, 'MyClass'; 1; #### here we are in DESTROY destroying MyClass