NAME

VarGuard - safe clean blocks for variables

VERSION

Version 0.03

SYNOPSIS

    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 { ... };
	...
    }

DESCRIPTION

This module is similar to Guard, except that this module is guard on a variable.

CAVEAT

This module will tie something on the variable. So don't use it on a tied variable, or tie the guarded variable.

EXPORT

var_guard

SUBROUTINES

var_guard { ...code block... } VAR(could be $, @, %, or any reference)

AUTHOR

Cindy Wang (CindyLinz)

BUGS

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.

LICENSE AND COPYRIGHT

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.

SEE ALSO

Guard