perl

 view release on metacpan or  search on metacpan

pod/perl5160delta.pod  view on Meta::CPAN

The C<SvIsCOW> C macro now returns false for read-only copies of typeglobs,
such as those created by:

  $hash{elem} = *foo;
  Hash::Util::lock_value %hash, 'elem';

It used to return true.

=item *

The C<SvPVutf8> C function no longer tries to modify its argument,
resulting in errors [perl #108994].

=item *

C<SvPVutf8> now works properly with magical variables.

=item *

C<SvPVbyte> now works properly non-PVs.

=item *

When presented with malformed UTF-8 input, the XS-callable functions
C<is_utf8_string()>, C<is_utf8_string_loc()>, and
C<is_utf8_string_loclen()> could read beyond the end of the input
string by up to 12 bytes.  This no longer happens.  [perl #32080].
However, currently, C<is_utf8_char()> still has this defect, see
L</is_utf8_char()> above.

=item *

The C-level C<pregcomp> function could become confused about whether the
pattern was in UTF8 if the pattern was an overloaded, tied, or otherwise
magical scalar [perl #101940].

=back

=head2 Compile-time hints

=over

=item *

Tying C<%^H> no longer causes perl to crash or ignore the contents of
C<%^H> when entering a compilation scope [perl #106282].

=item *

C<eval $string> and C<require> used not to
localize C<%^H> during compilation if it
was empty at the time the C<eval> call itself was compiled.  This could
lead to scary side effects, like C<use re "/m"> enabling other flags that
the surrounding code was trying to enable for its caller [perl #68750].

=item *

C<eval $string> and C<require> no longer localize hints (C<$^H> and C<%^H>)
at run time, but only during compilation of the $string or required file.
This makes C<BEGIN { $^H{foo}=7 }> equivalent to
C<BEGIN { eval '$^H{foo}=7' }> [perl #70151].

=item *

Creating a BEGIN block from XS code (via C<newXS> or C<newATTRSUB>) would,
on completion, make the hints of the current compiling code the current
hints.  This could cause warnings to occur in a non-warning scope.

=back

=head2 Copy-on-write scalars

Copy-on-write or shared hash key scalars
were introduced in 5.8.0, but most Perl code
did not encounter them (they were used mostly internally).  Perl
5.10.0 extended them, such that assigning C<__PACKAGE__> or a
hash key to a scalar would make it copy-on-write.  Several parts
of Perl were not updated to account for them, but have now been fixed.

=over

=item *

C<utf8::decode> had a nasty bug that would modify copy-on-write scalars'
string buffers in place (i.e., skipping the copy).  This could result in
hashes having two elements with the same key [perl #91834]. (5.14.2)

=item *

Lvalue subroutines were not allowing COW scalars to be returned.  This was
fixed for lvalue scalar context in Perl 5.12.3 and 5.14.0, but list context
was not fixed until this release.

=item *

Elements of restricted hashes (see the L<fields> pragma) containing
copy-on-write values couldn't be deleted, nor could such hashes be cleared
(C<%hash = ()>). (5.14.2)

=item *

Localizing a tied variable used to make it read-only if it contained a
copy-on-write string. (5.14.2)

=item *

Assigning a copy-on-write string to a stash
element no longer causes a double free.  Regardless of this change, the
results of such assignments are still undefined.

=item *

Assigning a copy-on-write string to a tied variable no longer stops that
variable from being tied if it happens to be a PVMG or PVLV internally.

=item *

Doing a substitution on a tied variable returning a copy-on-write
scalar used to cause an assertion failure or an "Attempt to free
nonexistent shared string" warning.



( run in 1.212 second using v1.01-cache-2.11-cpan-b301d465b3d )