package A;
sub new {
my $class = shift;
print 'Hello from ' . $class . "\n";
return bless {}, $class;
}
sub DESTROY {
my $self = shift;
print "A::DESTROY called from " . ref($self) . "\n";
}
package B;
our @ISA = qw( A );
sub DESTROY {
my $self = shift;
print "B::DESTROY called from " . ref($self) . "\n";
return $self->SUPER::DESTROY;
}
package main;
my $this = A->new();
my $that = B->new();
|