| Method-Destructor documentation | Contained in the Method-Destructor distribution. |
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.
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.
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.
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.
| Method-Destructor documentation | Contained in the Method-Destructor distribution. |
package Method::Destructor; use 5.008_001; use strict; our $VERSION = '0.02'; use XSLoader; XSLoader::load(__PACKAGE__, $VERSION); 1; __END__