Method::Destructor - Cumulative destructors
This document describes Method::Destructor version 0.02.
package Base; use Method::Destructor; sub DEMOLISH{ # ... } package Derived; use parent -norequire => qw(Base); use Method::Destructor -optional; sub DEMOLISH{ # ... } # ... my $x = Derived->new(); # when $x is released, # Derived::DEMOLISH and Base::DEMOLISH will be called respecively.
Method::Destructor provides cumulative destructors, or DEMOLISH methods, which are introduced by Perl Best Practices and implemented in modules such as Class::Std or Moose. DEMOLISH is a destructor like DESTROY, but acts as a cumulative method.
Method::Destructor
Class::Std
Moose
DEMOLISH
DESTROY
To use the cumulative destructors, say use Method::Destructor and replace DESTROY with DEMOLISH. You can also say use Method::Destructor -optional if the destructor does not touch external resources. Optional destructors will not be called if objects are released in global destruction.
use Method::Destructor
use Method::Destructor -optional
Perl 5.8.1 or later, and a C compiler.
No bugs have been reported.
Please report any bugs or feature requests to the author.
Class::Std.
Moose.
Goro Fuji <gfuji(at)cpan.org>.
Copyright (c) 2009, Goro Fuji. Some rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Method::Destructor, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Method::Destructor
CPAN shell
perl -MCPAN -e shell install Method::Destructor
For more information on module installation, please visit the detailed CPAN module installation guide.