… | |
… | |
84 | BLOCK calls C<exit>, C<goto>, C<last> or escapes via other means. |
84 | BLOCK calls C<exit>, C<goto>, C<last> or escapes via other means. |
85 | |
85 | |
86 | If multiple BLOCKs are registered to the same scope, they will be executed |
86 | If multiple BLOCKs are registered to the same scope, they will be executed |
87 | in reverse order. Other scope-related things such as C<local> are managed |
87 | in reverse order. Other scope-related things such as C<local> are managed |
88 | via the same mechanism, so variables C<local>ised I<after> calling |
88 | via the same mechanism, so variables C<local>ised I<after> calling |
89 | C<scope_guard> will be restored when the guard runs. |
89 | C<scope_guard> will be restored I<before> the guard runs. |
90 | |
90 | |
91 | Example: temporarily change the timezone for the current process, |
91 | Example: temporarily change the timezone for the current process, |
92 | ensuring it will be reset when the C<if> scope is exited: |
92 | ensuring it will be reset when the C<if> scope is exited: |
93 | |
93 | |
94 | use Guard; |
94 | use Guard; |