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

Comparing Guard/Guard.pm (file contents):
Revision 1.24 by root, Sat Jul 2 00:38:44 2011 UTC vs.
Revision 1.26 by root, Tue Mar 21 11:39:27 2017 UTC

42package Guard; 42package Guard;
43 43
44no warnings; 44no warnings;
45 45
46BEGIN { 46BEGIN {
47 $VERSION = '1.022'; 47 $VERSION = 1.023;
48 @ISA = qw(Exporter); 48 @ISA = qw(Exporter);
49 @EXPORT = qw(guard scope_guard); 49 @EXPORT = qw(guard scope_guard);
50 50
51 require Exporter; 51 require Exporter;
52 52
84BLOCK calls C<exit>, C<goto>, C<last> or escapes via other means. 84BLOCK calls C<exit>, C<goto>, C<last> or escapes via other means.
85 85
86If multiple BLOCKs are registered to the same scope, they will be executed 86If multiple BLOCKs are registered to the same scope, they will be executed
87in reverse order. Other scope-related things such as C<local> are managed 87in reverse order. Other scope-related things such as C<local> are managed
88via the same mechanism, so variables C<local>ised I<after> calling 88via the same mechanism, so variables C<local>ised I<after> calling
89C<scope_guard> will be restored when the guard runs. 89C<scope_guard> will be restored I<before> the guard runs.
90 90
91Example: temporarily change the timezone for the current process, 91Example: temporarily change the timezone for the current process,
92ensuring it will be reset when the C<if> scope is exited: 92ensuring it will be reset when the C<if> scope is exited:
93 93
94 use Guard; 94 use Guard;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines