VarGuard - safe clean blocks for variables
Version 0.03
use VarGuard; { var_guard { print "$_[0]\n" } my $scalar; $scalar = 'abc'; } # print "abc\n"; when scalar is destroyed { var_guard { print "@_\n" } my @array; ... } { var_guard { print "@_\n" } my %hash; ... } { var_guard { $_[0]() } my $code; $code = sub { ... }; ... }
This module is similar to Guard, except that this module is guard on a variable.
This module will tie something on the variable. So don't use it on a tied variable, or tie the guarded variable.
var_guard
Cindy Wang (CindyLinz)
Please report any bugs or feature requests to bug-varguard at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=VarGuard. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-varguard at rt.cpan.org
Copyright 2011 Cindy Wang (CindyLinz).
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
Guard
To install VarGuard, copy and paste the appropriate command in to your terminal.
cpanm
cpanm VarGuard
CPAN shell
perl -MCPAN -e shell install VarGuard
For more information on module installation, please visit the detailed CPAN module installation guide.