1B::Hooks::EndOfScope(3)User Contributed Perl DocumentatioBn::Hooks::EndOfScope(3)
2
3
4

NAME

6       B::Hooks::EndOfScope - Execute code after a scope finished compilation
7

VERSION

9       version 0.26
10

SYNOPSIS

12           on_scope_end { ... };
13

DESCRIPTION

15       This module allows you to execute code when perl finished compiling the
16       surrounding scope.
17

FUNCTIONS

19   on_scope_end
20           on_scope_end { ... };
21
22           on_scope_end $code;
23
24       Registers $code to be executed after the surrounding scope has been
25       compiled.
26
27       This is exported by default. See Sub::Exporter on how to customize it.
28

LIMITATIONS

30   Pure-perl mode caveat
31       This caveat applies to any version of perl where Variable::Magic is
32       unavailable or otherwise disabled.
33
34       While Variable::Magic has access to some very dark sorcery to make it
35       possible to throw an exception from within a callback, the pure-perl
36       implementation does not have access to these hacks. Therefore, what
37       would have been a compile-time exception is instead converted to a
38       warning, and your execution will continue as if the exception never
39       happened.
40
41       To explicitly request an XS (or PP) implementation one has two choices.
42       Either to import from the desired implementation explicitly:
43
44        use B::Hooks::EndOfScope::XS
45          or
46        use B::Hooks::EndOfScope::PP
47
48       or by setting $ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} to either "XS" or
49       "PP".
50
51   Perl 5.8.0 ~ 5.8.3
52       Due to a core interpreter bug
53        <https://rt.perl.org/Public/Bug/Display.html?id=27040#txn-82797>
54       present in older perl versions, the implementation of
55       B::Hooks::EndOfScope deliberately leaks a single empty hash for every
56       scope being cleaned. This is done to avoid the memory corruption
57       associated with the bug mentioned above.
58
59       In order to stabilize this workaround use of Variable::Magic is
60       disabled on perls prior to version 5.8.4. On such systems
61       loading/requesting B::Hooks::EndOfScope::XS explicitly will result in a
62       compile-time exception.
63
64   Perl versions 5.6.x
65       Versions of perl before 5.8.0 lack a feature allowing changing the
66       visibility of "%^H" via setting bit 17 within $^H. As such the only way
67       to achieve the effect necessary for this module to work, is to use the
68       "local" operator explicitly on these platforms. This might lead to
69       unexpected interference with other scope-driven libraries relying on
70       the same mechanism. On the flip side there are no such known
71       incompatibilities at the time this note was written.
72
73       For further details on the unavailable behavior please refer to the
74       test file t/02-localise.t included with the distribution.
75

SEE ALSO

77       Sub::Exporter
78
79       Variable::Magic
80

SUPPORT

82       Bugs may be submitted through the RT bug tracker
83       <https://rt.cpan.org/Public/Dist/Display.html?Name=B-Hooks-EndOfScope>
84       (or bug-B-Hooks-EndOfScope@rt.cpan.org <mailto:bug-B-Hooks-
85       EndOfScope@rt.cpan.org>).
86

AUTHORS

88       •   Florian Ragwitz <rafl@debian.org>
89
90       •   Peter Rabbitson <ribasushi@leporine.io>
91

CONTRIBUTORS

93       •   Karen Etheridge <ether@cpan.org>
94
95       •   Christian Walde <walde.christian@googlemail.com>
96
97       •   Graham Knop <haarg@haarg.org>
98
99       •   Simon Wilper <sxw@chronowerks.de>
100
101       •   Tatsuhiko Miyagawa <miyagawa@bulknews.net>
102
103       •   Tomas Doran <bobtfish@bobtfish.net>
104
106       This software is copyright (c) 2008 by Florian Ragwitz.
107
108       This is free software; you can redistribute it and/or modify it under
109       the same terms as the Perl 5 programming language system itself.
110
111
112
113perl v5.36.0                      2022-07-22           B::Hooks::EndOfScope(3)
Impressum