--- Guard/Guard.pm 2009/01/13 23:30:38 1.18 +++ 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 = '1.01'; + $VERSION = '1.021'; @ISA = qw(Exporter); @EXPORT = qw(guard scope_guard);