NAME
Method::Destructor - Cumulative destructors
VERSION
This document describes Method::Destructor version 0.02.
SYNOPSIS
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.
DESCRIPTION
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.
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.
DEPENDENCIES
Perl 5.8.1 or later, and a C compiler.
BUGS
No bugs have been reported.
Please report any bugs or feature requests to the author.
SEE ALSO
AUTHOR
Goro Fuji <gfuji(at)cpan.org>.
LICENSE AND COPYRIGHT
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.