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

Comparing Guard/Guard.pm (file contents):
Revision 1.23 by root, Fri Mar 12 17:25:58 2010 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.021'; 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;
197solution to the problem of exceptions. 197solution to the problem of exceptions.
198 198
199=head1 SEE ALSO 199=head1 SEE ALSO
200 200
201L<Scope::Guard> and L<Sub::ScopeFinalizer>, which actually implement 201L<Scope::Guard> and L<Sub::ScopeFinalizer>, which actually implement
202dynamic guards only, not scoped guards, and have a lot higher CPU, memory 202dynamically scoped guards only, not the lexically scoped guards that their
203and typing overhead. 203documentation promises, and have a lot higher CPU, memory and typing
204overhead.
204 205
205L<Hook::Scope>, which has apparently never been finished and can corrupt 206L<Hook::Scope>, which has apparently never been finished and can corrupt
206memory when used. 207memory when used.
207 208
209L<Scope::Guard> seems to have a big SEE ALSO section for even more
210modules like it.
211
208=cut 212=cut
209 213

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines