diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-09-13 23:33:03 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-09-14 22:29:44 -0700 |
commit | f07626add3eda6dfda7c5f6fe05cbe1c9293ccd2 (patch) | |
tree | a1762b06a4a7cc29cc6504beead035305a109e80 /t/op/caller.t | |
parent | 38248b9d23f2dd91529d8b3c32ad8f5f3ec93950 (diff) | |
download | perl-f07626add3eda6dfda7c5f6fe05cbe1c9293ccd2.tar.gz |
Make (caller $n)[9] respect std warnings
In commit 7e4f04509c6 I forgot about caller. This commit makes the
value returned by (caller $n)[9] assignable to ${^WARNING_BITS} to
produce exactly the same warnings settings, including warnings con-
trolled by $^W.
Diffstat (limited to 't/op/caller.t')
-rw-r--r-- | t/op/caller.t | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/t/op/caller.t b/t/op/caller.t index b7c5f9b5ca..0735eaaddc 100644 --- a/t/op/caller.t +++ b/t/op/caller.t @@ -5,7 +5,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; - plan( tests => 90 ); + plan( tests => 91 ); } my @c; @@ -280,6 +280,23 @@ is eval "s//<<END/e;\nfoo\nEND\n(caller 0)[6]", "s//<<END/e;\nfoo\nEND\n(caller 0)[6]", 'here-docs in quote-like ops do not gut eval text'; +# The bitmask should be assignable to ${^WARNING_BITS} without resulting in +# different warnings settings. +{ + my $ bits = sub { (caller 0)[9] }->(); + my $w; + local $SIG{__WARN__} = sub { $w++ }; + eval ' + use warnings; + BEGIN { ${^WARNING_BITS} = $bits } + local $^W = 1; + () = 1 + undef; + $^W = 0; + () = 1 + undef; + '; + is $w, 1, 'value from (caller 0)[9] (bitmask) works in ${^WARNING_BITS}'; +} + $::testing_caller = 1; do './op/caller.pl' or die $@; |