NAME
Variable::OnDestruct - Call a subroutine on destruction of a variable.
VERSION
Version 0.03
SYNOPSIS
use Variable::OnDestruct;
on_destruct $var, sub { do_something() };
on_destruct @array, sub { do_something_else() };
on_destruct %array, sub { hashes_work_too() };
on_destruct &$sub, sub { so_do_closures($but_not_normal_subs) };
on_destruct *$glob, sub { and_even_globs($similar_caveats_as_subs_though) };
DESCRIPTION
This module allows you to let a function be called when a variable gets destroyed. The destructor will work not only on scalars but also on arrays, hashes, subs and globs. For the latter two you should realize that most of them aren't scoped like normal variables. Subs for example will only work like you expect them to when they are closures.
FUNCTIONS
This module contains one function, which is exported by default.
on_destruct $variable, \⊂
This function adds a destructor to a variable.
AUTHOR
Leon Timmermans, <leont at cpan.org>
BUGS
Please report any bugs or feature requests to bug-devel-ondestruct at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Variable-OnDestruct. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Variable::OnDestruct
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Variable-OnDestruct
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
COPYRIGHT & LICENSE
Copyright 2009,2010 Leon Timmermans, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.