Next | Tricks of the Wizards | 109 |
Consider this class inheritance structure:
Now consider D::DESTROY
We would like D::DESTROY to call B::DESTROY (if there is one)
Moreover B::DESTROY should call A::DESTROY (ditto)
We can accomplish that this way:
# Package D sub DESTROY { my $self = shift; # Do various destructions here $self->SUPER::DESTROY; }
SUPER::DESTROY means "call DESTROY"
If B::DESTROY also calls SUPER::DESTROY, everything works as it should
Next | Copyright © 2003 M. J. Dominus |