diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-11-21 08:24:06 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-22 04:54:06 -0800 |
commit | 199670db6c499615e0f5f53e3c84aa6f11584ff1 (patch) | |
tree | 25209d29cddef71a5d6a8865cd738e7cdf5d3c0a /t/op/magic.t | |
parent | 1b0fd1e8346658cb037cc394f0c428007124b916 (diff) | |
download | perl-199670db6c499615e0f5f53e3c84aa6f11584ff1.tar.gz |
Protect ${^E_NCODING} from abuse
When read, it is now always undef. When set, it croaks as though
read-only except in the encoding package. Hopefully that will dis-
suade anyone from depending on it.
Diffstat (limited to 't/op/magic.t')
-rw-r--r-- | t/op/magic.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/t/op/magic.t b/t/op/magic.t index afc99c57c4..bb9d175b4d 100644 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -5,7 +5,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; - plan (tests => 187); + plan (tests => 190); } # Test that defined() returns true for magic variables created on the fly, @@ -675,6 +675,12 @@ is ${^MPEN}, undef, '${^MPEN} starts undefined'; # This one used to croak due to that missing break: is ++${^MPEN}, 1, '${^MPEN} can be incremented'; +eval { ${^E_NCODING} = 1 }; +like $@, qr/^Modification of a /, 'Setting ${^E_NCODING} croaks'; +$_ = ${^E_NCODING}; +pass('can read ${^E_NCODING} without blowing up'); +is $_, undef, '${^E_NCODING} is undef'; + # ^^^^^^^^^ New tests go here ^^^^^^^^^ SKIP: { |