diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-11-17 08:34:31 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-11-17 09:18:02 -0800 |
commit | 16c632750a8d65ba39bf6c2e2b149e3ffebf467a (patch) | |
tree | cea370764d98d5bc12135180d4750fb2e46c0d78 /MANIFEST | |
parent | cd6472fc34fd70358c7c0cf2c39a2eb7fe57114d (diff) | |
download | perl-16c632750a8d65ba39bf6c2e2b149e3ffebf467a.tar.gz |
Localise PL_curcop for BEGIN blocks
Usually when a BEGIN block exits it has to set PL_curcop to
&PL_compiling, so that subsequent compiled code in the surrounding
scope will have the right warning hints during compilation.
If an XS function creates a BEGIN block via newXS or newATTRSUB, how-
ever, the assumption that compilation will resume as soon as the block
exits is false.
This can be demonstrated with this code, which warns about CHECK and
INIT blocks created too late when it shouldn’t due to ‘no warnings’:
use warnings;
eval q|
BEGIN{
no warnings;
package XS::APItest; require XSLoader; XSLoader::load()
}
|;
In every case where it is correct for BEGIN to set PL_curcop to
&PL_compiling when it exits it is actually just restoring it to its
previous value, so localisation is the right fix.
Diffstat (limited to 'MANIFEST')
-rw-r--r-- | MANIFEST | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -3880,6 +3880,7 @@ ext/XS-APItest/t/Block.pm Helper for ./blockhooks.t ext/XS-APItest/t/call_checker.t test call checker plugin API ext/XS-APItest/t/caller.t XS::APItest: tests for caller_cx ext/XS-APItest/t/call.t XS::APItest extension +ext/XS-APItest/t/check_warnings.t test scope of "Too late for CHECK" ext/XS-APItest/t/cleanup.t test stack behaviour on unwinding ext/XS-APItest/t/clone-with-stack.t test clone with CLONEf_COPY_STACKS works ext/XS-APItest/t/cophh.t test COPHH API |