Debian Codegraph @

README

raw
1 NAME
2
3 Lexical::SealRequireHints - prevent leakage of lexical hints
4
5 DESCRIPTION
6
7 This module works around two historical bugs in Perl's handling of the
8 "%^H" (lexical hints) variable. One bug causes lexical state in one
9 file to leak into another that is "require"d/"use"d/"do"ed from it.
10 This bug, [perl #68590], was present from Perl 5.6 up to Perl 5.10, fixed
11 in Perl 5.11.0. The second bug causes lexical state (normally a blank
12 "%^H" once the first bug is fixed) to leak outwards from "utf8.pm", if
13 it is automatically loaded during Unicode regular expression matching,
14 into whatever source is compiling at the time of the regexp match.
15 This bug, [perl #73174], was present from Perl 5.8.7 up to Perl 5.11.5,
16 fixed in Perl 5.12.0.
17
18 Both of these bugs seriously damage the usability of any module relying
19 on "%^H" for lexical scoping, on the affected Perl versions. It is in
20 practice essential to work around these bugs when using such modules.
21 On versions of Perl that require such a workaround, this module globally
22 changes the behaviour of "require", including "use" and the implicit
23 "require" performed in Unicode regular expression matching, and of "do",
24 so that they no longer exhibit these bugs.
25
26 The workaround supplied by this module takes effect the first time its
27 "import" method is called. Typically this will be done by means of a
28 "use" statement. This should be done as early as possible, because it
29 only affects "require"/"use"/"do" statements that are compiled after the
30 workaround goes into effect. For "use" statements, and "require" and
31 "do" statements that are executed immediately and only once, it suffices
32 to invoke the workaround when loading the first module that will set up
33 vulnerable lexical state. Delayed-action "require" and "do" statements,
34 however, are more troublesome, and can require the workaround to be loaded
35 much earlier. Ultimately, an affected Perl program may need to load
36 the workaround as very nearly its first action. Invoking this module
37 multiple times, from multiple modules, is not a problem: the workaround
38 is only applied once, and applies to everything subsequently compiled.
39
40 This module is implemented in XS, with a pure Perl backup version
41 for systems that can't handle XS modules. The XS version has a better
42 chance of playing nicely with other modules that modify "require" or "do"
43 handling. The pure Perl version can't work at all on some Perl versions;
44 users of those versions must use the XS. On all Perl versions suffering
45 the underlying hint leakage bug, pure Perl hooking of "require" breaks the
46 use of "require" without an explicit parameter (implicitly using "$_").
47
48 INSTALLATION
49
50 perl Build.PL
51 ./Build
52 ./Build test
53 ./Build install
54
55 AUTHOR
56
57 Andrew Main (Zefram) <[email protected]>
58
59 COPYRIGHT
60
61 Copyright (C) 2009, 2010, 2011, 2012, 2015, 2016, 2017, 2023
62 Andrew Main (Zefram) <[email protected]>
63
64 LICENSE
65
66 This module is free software; you can redistribute it and/or modify it
67 under the same terms as Perl itself.