--- Guard/Guard.pm 2008/12/15 02:38:21 1.16 +++ Guard/Guard.pm 2009/07/19 05:44:10 1.21 @@ -15,6 +15,11 @@ code_that_might_die_or_does_other_fun_stuff; } + # create an object that, when the last reference to it is gone, + # invokes the given codeblock: + my $guard = guard { print "destroyed!\n" }; + undef $guard; # probably destroyed here + =head1 DESCRIPTION This module implements so-called "guards". A guard is something (usually @@ -39,7 +44,7 @@ no warnings; BEGIN { - $VERSION = '0.5'; + $VERSION = '1.021'; @ISA = qw(Exporter); @EXPORT = qw(guard scope_guard);