This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In PL_magic_data flag whether magic can be added to a readonly value.
authorNicholas Clark <nick@ccl4.org>
Sun, 15 May 2011 13:45:53 +0000 (14:45 +0100)
committerNicholas Clark <nick@ccl4.org>
Sat, 11 Jun 2011 08:39:59 +0000 (10:39 +0200)
commit82ff486e3dffdd873d119ab2245448a996948e2d
tree9853646997e1cd61fb27786a8f09d11891474cd8
parente0a73de458fc6a8b96ea80ab0485ce7bdabb4c8b
In PL_magic_data flag whether magic can be added to a readonly value.

Use this to simplify the logic in Perl_sv_magic().

This introduces a small change of behaviour for error cases involving unknown
magic types. Previously, if Perl_sv_magic() was passed a magic type unknown to
it, it would

1: Croak "Modification of a read-only value attempted" if read only
2: Return without error if the SV happened to already have this magic
3: otherwise croak "Don't know how to handle magic of type \\%o"

Now it will always croak "Don't know how to handle magic of type \\%o", even
on read only values, or SVs which already have the unknown magic type.
mg_raw.h
perl.h
regen/mg_vtable.pl
sv.c