%^H introduced. It exists only as a hash at compile time. It is not
localised by require, so lexical hints leak into every module loaded,
which is bug [perl #68590].
The CORE::GLOBAL mechanism doesnt work cleanly for require, because overriding require loses the necessary special parsing of bareword arguments to it. As a result, pure Perl code cant properly globally affect the behaviour of require. Pure Perl code can localise %^H itself for any particular require invocation, but a global fix is only possible through XS.
|Perl 5.7.2||The CORE::GLOBAL mechanism now works cleanly for require, so pure Perl code can globally affect the behaviour of require to achieve a global fix for the bug.|
|Perl 5.8.7||When utf8.pm is automatically loaded during Unicode regular expression matching, %^H now leaks outward from it into whatever source is compiling at the time of the regexp match, which is bug [perl #73174]. It often goes unnoticed, because [perl #68590] makes %^H leak into utf8.pm which then doesnt modify it, so what leaks out tends to be identical to what leaked in. If [perl #68590] is worked around, however, %^H tends to be (correctly) blank inside utf8.pm, and this bug therefore blanks it for the outer module.|
%^H now exists in two forms. In addition to the relatively ordinary
hash that is modified during compilation, the value that it had at
each point in compilation is recorded in the compiled op tree, for later
examination at runtime. It is in a special representation-sharing format,
and writes to %^H are meant to be performed on both forms. require
does not localise the runtime form of %^H (and still doesnt localise
the compile-time form).
A couple of special %^H entries are erroneously written only to the runtime form.
Pure Perl code, although it can localise the compile-time %^H by normal means, cant adequately localise the runtime %^H, except by using a string eval stack frame. This makes a satisfactory global fix for the leakage bug impossible in pure Perl.
require now properly localises the runtime form of %^H, but still
not the compile-time form.
A global fix is once again possible in pure Perl, because the fix only needs to localise the compile-time form.
require now properly localises both forms of %^H, fixing [perl
#68590]. This makes [perl #73174] apparent without any workaround for
The special %^H entries are now correctly written to both forms of the hash.
|Perl 5.12.0||The automatic loading of utf8.pm during Unicode regular expression matching now properly restores %^H, fixing [perl #73174].|
The operation of this module depends on influencing the compilation of require. As a result, it cannot prevent lexical state leakage through a require statement that was compiled before this module was invoked. Where problems occur, this module must be invoked earlier.
On all Perl versions that need a fix for the lexical hint leakage bug, the pure Perl implementation of this module unavoidably breaks the use of require without an explicit parameter (implicitly using $_). This is due to another bug in the Perl core, fixed in Perl 5.15.5, and is inherent to the mechanism by which pure Perl code can hook require. The use of implicit $_ with require is rare, so although this state of affairs is faulty it will actually work for most programs. Perl versions 5.12.0 and greater, despite having the require hooking bug, dont actually exhibit a problem with the pure Perl version of this module, because with the lexical hint leakage bug fixed there is no need for this module to hook require.
Andrew Main (Zefram) <email@example.com>
Copyright (C) 2009, 2010, 2011, 2012, 2015, 2016 Andrew Main (Zefram) <firstname.lastname@example.org>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||LEXICAL::SEALREQUIREHINTS (3)||2016-04-03|