in reply to DESTROY problem
But that doesn't help if you're doing MI. This does:sub DESTROY { my $self = shift; ... do class specific stuff ... $self->SUPER::DESTROY if $self->can("SUPER::DESTROY"); }
That will do the right thing, regardless how many (even 0) classes you're inheriting.sub DESTROY { my $self = shift; .... foreach my $class (@ISA) { my $destroy = "${class}::DESTROY"; $self->$destroy if $self->can($destroy); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DESTROY problem
by 7stud (Deacon) on Dec 31, 2010 at 22:47 UTC | |
by Mr. Muskrat (Canon) on Jan 01, 2011 at 18:04 UTC | |
by JavaFan (Canon) on Jan 01, 2011 at 19:36 UTC |