ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Guard/Guard.pm
(Generate patch)

Comparing Guard/Guard.pm (file contents):
Revision 1.22 by root, Sun Jul 26 08:07:11 2009 UTC vs.
Revision 1.23 by root, Fri Mar 12 17:25:58 2010 UTC

56 56
57our $DIED = sub { warn "$@" }; 57our $DIED = sub { warn "$@" };
58 58
59=item scope_guard BLOCK 59=item scope_guard BLOCK
60 60
61=item scope_guard ($coderef)
62
61Registers a block that is executed when the current scope (block, 63Registers a block that is executed when the current scope (block,
62function, method, eval etc.) is exited. 64function, method, eval etc.) is exited.
63 65
64See the EXCEPTIONS section for an explanation of how exceptions 66See the EXCEPTIONS section for an explanation of how exceptions
65(i.e. C<die>) are handled inside guard blocks. 67(i.e. C<die>) are handled inside guard blocks.
102 104
103 # do something with the new timezone 105 # do something with the new timezone
104 } 106 }
105 107
106=item my $guard = guard BLOCK 108=item my $guard = guard BLOCK
109
110=item my $guard = guard ($coderef)
107 111
108Behaves the same as C<scope_guard>, except that instead of executing 112Behaves the same as C<scope_guard>, except that instead of executing
109the block on scope exit, it returns an object whose lifetime determines 113the block on scope exit, it returns an object whose lifetime determines
110when the BLOCK gets executed: when the last reference to the object gets 114when the BLOCK gets executed: when the last reference to the object gets
111destroyed, the BLOCK gets executed as with C<scope_guard>. 115destroyed, the BLOCK gets executed as with C<scope_guard>.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines