This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make tr/a/b/ croak on read-only null COWs
authorFather Chrysostomos <sprout@cpan.org>
Tue, 6 Aug 2013 20:05:20 +0000 (13:05 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 11 Aug 2013 14:41:26 +0000 (07:41 -0700)
commitd8b516a1046e5fdab4de366564c3388df9504b5d
tree55df660277d38fccfb3c63ce175a999b119f144d
parente811af66c955bc63db487a23e734136b67380030
Make tr/a/b/ croak on read-only null COWs

$ ./perl -Ilib -e 'use constant nullrocow => (keys%{{""=>undef}})[0]; for(nullrocow) { y/a/b/ }'
$ ./perl -Ilib -e 'use constant nullro => ""; for(nullro) { y/a/b/ }'
Modification of a read-only value attempted at -e line 1.

It should croak on COW scalars that are read-only, even if they are
zero-length, just as it does on non-COW scalars.

This logic is left over from when READONLY+FAKE meant COW.
doop.c
t/op/tr.t