… | |
… | |
34 | |
34 | |
35 | =cut |
35 | =cut |
36 | |
36 | |
37 | package Guard; |
37 | package Guard; |
38 | |
38 | |
|
|
39 | no warnings; |
|
|
40 | |
39 | BEGIN { |
41 | BEGIN { |
40 | $VERSION = '0.1'; |
42 | $VERSION = '0.5'; |
41 | @ISA = qw(Exporter); |
43 | @ISA = qw(Exporter); |
42 | @EXPORT = qw(guard scope_guard); |
44 | @EXPORT = qw(guard scope_guard); |
43 | |
45 | |
44 | require Exporter; |
46 | require Exporter; |
45 | |
47 | |
… | |
… | |
137 | can create multiple timers or other event watchers and only when the last |
139 | can create multiple timers or other event watchers and only when the last |
138 | one gets executed will the lock be unlocked. Using the C<guard>, you do |
140 | one gets executed will the lock be unlocked. Using the C<guard>, you do |
139 | not have to worry about catching all the places where you have to unlock |
141 | not have to worry about catching all the places where you have to unlock |
140 | the semaphore. |
142 | the semaphore. |
141 | |
143 | |
142 | =item Guard::cancel $guard |
144 | =item $guard->cancel |
143 | |
145 | |
144 | Calling this function will "disable" the guard object returned by the |
146 | Calling this function will "disable" the guard object returned by the |
145 | C<guard> function, i.e. it will free the BLOCK originally passed to |
147 | C<guard> function, i.e. it will free the BLOCK originally passed to |
146 | C<guard >and will arrange for the BLOCK not to be executed. |
148 | C<guard >and will arrange for the BLOCK not to be executed. |
147 | |
149 | |