Bug#506248: ITP: libobject-destroyer-perl -- make objects with circular references DESTROY normally
Package: wnpp
Severity: wishlist
Owner: Ansgar Burchardt <ansgar@43-1.org>
* Package name : libobject-destroyer-perl
Version : 2.00
Upstream Author : Adam Kennedy <adamk@cpan.org>
* URL : http://search.cpan.org/dist/Object-Destroyer/
* License : GPL-1+ | Artistic (like Perl)
Programming Lang: Perl
Description : make objects with circular references DESTROY normally
One of the biggest problem with working with large, nested object
trees is implementing a way for a child node to see its parent. The
easiest way to do this is to add a reference to the child back to its
parent.
.
This results in a "circular" reference, where A refers to B refers to
A. Unfortunately, the garbage collector perl uses during runtime is
not capable of knowing whether or not something ELSE is referring to
these circular references.
.
In practical terms, this means that object trees in lexically scoped
variable ( e.g. my $Object = Tree->new ) will not be cleaned up when
they fall out of scope, like normal variables. This results in a
memory leak for the life of the process, which is a bad thing when
using mod_perl or other processes that live for a long time.
.
Object::Destroyer allows for the creation of "Destroy" handles. The
handle is "attached" to the circular relationship, but is not a part
of it. When the destroy handle falls out of scope, it will be cleaned
up correctly, and while being cleaned up, it will also force the data
structure it is attached to to be destroyed as well. Object::Destroyer
can call a specified release method on an object (or method DESTROY by
default). Alternatively, it can execute an arbitrary user code passed
to constructor as a code reference.
(description taken from the module documentation)
The package is required by the new upstream release of
libparse-mediawikidump-perl.
Ansgar
--
PGP: 1024D/595FAD19 739E 2D09 0969 BEA9 9797 B055 DDB0 2FF7 595F AD19
Reply to: