diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/overload.t | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/overload.t b/lib/overload.t index 74adae340e..aa99cc298b 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -48,7 +48,7 @@ package main; $| = 1; BEGIN { require './test.pl' } -plan tests => 5191; +plan tests => 5193; use Scalar::Util qw(tainted); @@ -1293,6 +1293,20 @@ foreach my $op (qw(<=> == != < <= > >=)) { } { + # Check readonliness of constants, whether shared hash key + # scalars or no (brought up in bug #109744) + BEGIN { overload::constant integer => sub { "main" }; } + eval { ${\5} = 'whatever' }; + like $@, qr/^Modification of a read-only value attempted at /, + 'constant overloading makes read-only constants'; + BEGIN { overload::constant integer => sub { __PACKAGE__ }; } + eval { ${\5} = 'whatever' }; + local $::TODO = ' '; + like $@, qr/^Modification of a read-only value attempted at /, + '... even with shared hash key scalars'; +} + +{ package Sklorsh; use overload bool => sub { shift->is_cool }; |