=encoding utf8

=head1 NAME

perl5217delta - what is new for perl v5.21.7

=head1 DESCRIPTION

This document describes differences between the 5.21.6 release and the 5.21.7
release.

If you are upgrading from an earlier release such as 5.21.5, first read
L<perl5216delta>, which describes differences between 5.21.5 and 5.21.6.

=head1 Core Enhancements

=head2 faster array and hash lookups

Array and hash lookups (especially nested ones) that use only constants
or simple variables as keys, are now considerably faster. See
L</Internal Changes> for more details.

=head2 C<fileno> now works on directory handles

When the relevant support is available in the operating system, the
C<fileno> builtin now works on directory handles, yielding the
underlying file descriptor in the same way as for filehandles. On
operating systems without such support, C<fileno> on a directory handle
continues to return the undefined value, as before, but also sets C<$!> to
indicate that the operation is not supported.

Currently, this uses either a C<dd_fd> member in the OS C<DIR>
structure, or a dirfd(3) function as specified by POSIX.1-2008.

=head1 Incompatible Changes

=head2 C<&> and C<\&> prototypes accepts only subs

The C<&> prototype character now accepts only anonymous subs (C<sub {...}>)
and things beginning with C<\&>.  Formerly it erroneously also allowed
C<undef> and references to array, hashes, and lists.  [perl #4539]
[perl #123062]

The C<\&> prototype was allowing subroutine calls, whereas now it only
allows subroutines.  C<&foo> is permitted.  C<&foo()> and C<foo()> are not.
[perl #77860]

=head2 C<use encoding> is now lexical

The L<encoding> pragma's effect is now limited to lexical scope.  This
pragma is deprecated, but in the meantime, it could adversely affect
unrelated modules that are included in the same program.

=head2 List slices returning empty lists

List slices return an empty list now only if the original list was empty
(or if there are no indices).  Formerly, a list slice would return an empty
list if all indices fell outside the original list.  [perl #114498]

=head1 Deprecations

=head2 Setting C<${^ENCODING}> to anything but C<undef>

This variable allows Perl scripts to be written in a non-ASCII,
non-UTF-8 encoding.  However, it affects all modules globally, leading
to wrong answers and segmentation faults.  New scripts should be written
in UTF-8; old scripts should be converted to UTF-8, which is easily done
with the L<encoding> pragma.

=head1 Performance Enhancements

=over 4

=item *

Win32 Perl uses 8 KB less of per-process memory than before for every perl
process of this version. This data is now memory mapped from disk and shared
between perl processes from the same perl binary.

=item *

If method and class names are known at compile time, hashes are precomputed
to speed up run-time method lookup.  Also, compound method names like
C<SUPER::new> are parsed at compile time, to save having to parse them at
run time.

=back

=head1 Modules and Pragmata

=head2 Updated Modules and Pragmata

=over 4

=item *

The PathTools module collection has been upgraded from 3.52 to 3.53.

Don't turn leading C<//> into C</> on Cygwin. [perl #122635]

=item *

L<Archive::Tar> has been upgraded from version 2.02 to 2.04.

=item *

L<arybase> has been upgraded from version 0.08 to 0.09.

=item *

L<B> has been upgraded from version 1.53 to 1.54.

Nulled COPs are now of class C<B::COP>, rather than C<B::OP>.

B::REGEXP objects now provide a C<qr_anoncv> method for accessing the
implicit CV associated with C<qr//> things containing code blocks, and a
C<compflags> method that returns the pertinent flags originating from the
C<qr//blahblah> op.

B::PMOP now provides a C<pmregexp> method returning a B::REGEXP object.

Two new classes, B::PADNAME and B::PADNAMELIST, have been introduced.

=item *

L<B::Concise> has been upgraded from version 0.995 to 0.996.

=item *

L<B::Deparse> has been upgraded from version 1.30 to 1.31.

BEGIN blocks at the end of the enclosing scope are now deparsed in the
right place.  [perl #77452]

BEGIN blocks were sometimes deparsed as __ANON__, but are now always called
BEGIN.

Lexical subroutines are now fully deparsed.  [perl #116553]

Deparsing of C<$lexical =~ //> was accidentally broken in 1.30 (perl
5.21.6), omitting the C<$lexical =~>, but has now been fixed.

C<Anything =~ y///r> with C</r> no longer omits the left-hand operand.

The op trees that make up regexp code blocks are now deparsed for real.
Formerly, the original string that made up the regular expression was used.
That caused problems with C<qr/(?{E<lt>E<lt>heredoc})/> and multiline code blocks,
which were deparsed incorrectly.  [perl #123217] [perl #115256]

C<$;> at the end of a statement no longer loses its semicolon.
[perl #123357]

Some cases of subroutine declarations stored in the stash in shorthand form
were being omitted.

Non-ASCII characters are now consistently escaped in strings, instead of
some of the time.  (There are still outstanding problems with regular
expressions and identifiers that have not been fixed.)

When prototype sub calls are deparsed with C<&> (e.g., under the B<-P>
option), C<scalar> is now added where appropriate, to force the scalar
context implied by the prototype.

C<require(foo())>, C<do(foo())>, C<goto(foo())> and similar constructs with
loop controls are now deparsed correctly.  The outer parentheses are not
optional.

Whitespace is no longer escaped in regular expressions, because it was
getting erroneously escaped within C<(?x:...)> sections.

C<sub foo { foo() }> is now deparsed with those mandatory parentheses.

C</@array/> is now deparsed as a regular expression, and not just
C<@array>.

C</@{-}/>, C</@{+}/> and C<$#{1}> are now deparsed with the braces, which
are mandatory in these cases.

In deparsing feature bundles, B::Deparse was emitting C<no feature;> first
instead of C<no feature ':all';>.  This has been fixed.

C<chdir FH> is now deparsed without quotation marks.

C<\my @a> is now deparsed without parentheses.  (Parenthese would flatten
the array.)

C<system> and C<exec> followed by a block are now deparsed correctly.
Formerly there was an erroneous C<do> before the block.

C<< use constant QR =E<gt> qr/.../flags >> followed by C<"" =~ QR> is no longer
without the flags.

=item *

L<charnames> has been upgraded from version 1.41 to 1.43.

=item *

L<Compress::Raw::Bzip2> has been upgraded from version 2.066 to 2.067.

=item *

L<Compress::Raw::Zlib> has been upgraded from version 2.066 to 2.067.

=item *

L<Data::Dumper> has been upgraded from version 2.154 to 2.155.

=item *

L<DB_File> has been upgraded from version 1.831 to 1.834.

=item *

L<Devel::Peek> has been upgraded from version 1.19 to 1.20.

=item *

L<Devel::PPPort> has been upgraded from version 3.24 to 3.25.

=item *

L<DynaLoader> has been upgraded from version 1.28 to 1.29.

=item *

L<Encode> has been upgraded from version 2.64 to 2.67.

=item *

L<Errno> has been upgraded from version 1.21 to 1.22.

=item *

L<ExtUtils::CBuilder> has been upgraded from version 0.280220 to 0.280221.

=item *

L<ExtUtils::MakeMaker> has been upgraded from version 7.02 to 7.04.

=item *

L<ExtUtils::ParseXS> has been upgraded from version 3.26 to 3.27.

Only declare C<file> unused if we actually define it.

Improve generated C<RETVAL> code generation to avoid repeated
references to C<ST(0)>.  [perl #123278]

Broaden and document the C</OBJ$/> to C</REF$/> typemap optimization
for the C<DESTROY> method.  [perl #123418]

=item *

L<feature> has been upgraded from version 1.38 to 1.39.

=item *

L<File::Spec> has been upgraded from version 3.51 to 3.54.

=item *

L<Filter::Util::Call> has been upgraded from version 1.49 to 1.51.

=item *

L<HTTP::Tiny> has been upgraded from version 0.051 to 0.053.

=item *

L<IO> has been upgraded from version 1.34 to 1.35.

=item *

The IO::Compress module collection has been upgraded from version 2.066 to 2.067.

=item *

L<IO::Socket::IP> has been upgraded from version 0.32 to 0.34.

=item *

L<Locale::Codes> has been upgraded from version 3.32 to 3.33.

=item *

L<Locale::Maketext> has been upgraded from version 1.25 to 1.26.

=item *

L<Module::CoreList> has been upgraded from version 5.20141120 to 5.20141220.

=item *

L<mro> has been upgraded from version 1.16 to 1.17.

=item *

L<NDBM_File> has been upgraded from version 1.13 to 1.14.

=item *

L<Opcode> has been upgraded from version 1.29 to 1.30.

=item *

L<PerlIO::scalar> has been upgraded from version 0.20 to 0.21.

Reading from a position well past the end of the scalar now correctly
returns end of file.  [perl #123443]

Seeking to a negative position still fails, but no longer leaves the
file position set to a negation location.

C<eof()> on a C<PerlIO::scalar> handle now properly returns true when
the file position is past the 2GB mark on 32-bit systems.

=item *

L<Pod::Escapes> has been upgraded from version 1.06 to 1.07.

=item *

L<POSIX> has been upgraded from version 1.46 to 1.48.

=item *

L<SDBM_File> has been upgraded from version 1.11 to 1.12.

=item *

L<Storable> has been upgraded from version 2.51 to 2.52.

=item *

L<strict> has been upgraded from version 1.08 to 1.09.

=item *

L<Sys::Hostname> has been upgraded from version 1.19 to 1.20.

=item *

L<Test::Simple> has been upgraded from version 1.301001_075 to 1.301001_090.

=item *

L<threads> has been upgraded from version 1.96 to 1.96_001.

=item *

L<Unicode::Collate> has been upgraded from version 1.07 to 1.09.

=item *

L<XSLoader> has been upgraded from version 0.19 to 0.20

Don't test twice for bootstrap file.

=back

=head1 Diagnostics

The following additions or changes have been made to diagnostic output,
including warnings and fatal error messages.  For the complete list of
diagnostic messages, see L<perldiag>.

=head2 Changes to Existing Diagnostics

=over 4

=item *

"Variable %s will not stay shared" has been changed to say "Subroutine"
when it is actually a lexical sub that will not stay shared.

=back

=head1 Platform Support

=head2 Platform-Specific Notes

=head3 Win32

=over

=item *

Intel C builds are now always built with C99 mode on.

=back

=head1 Internal Changes

=over 4

=item *

The PADNAME and PADNAMELIST types are now separate types, and no longer
simply aliases for SV and AV.  [perl #123223]

=item *

Pad names are now always UTF8.  The C<PadnameUTF8> macro always returns
true.  Previously, this was effectively the case already, but any support
for two different internal representations of pad names has now been
removed.

=item *

The C<OP_SIBLING> and C<OP_HAS_SIBLING> macros added in an earlier 5.21.x
release have been renamed C<OpSIBLING> and C<OpHAS_SIBLING>, following the
existing convention.

=item *

A new op class, C<UNOP_AUX>, has been added. This is a subclass of
C<UNOP> with an C<op_aux> field added, which points to an array of unions
of C<UV>, C<SV*> etc. It is intended for where an op needs to store more data
than a simple C<op_sv> or whatever. Currently the only op of this type is
C<OP_MULTIDEREF> (see below).

=item *

A new op has been added, C<OP_MULTIDEREF>, which performs one or more
nested array and hash lookups where the key is a constant or simple
variable. For example the expression C<$a[0]{$k}[$i]>, which previously
involved ten C<rv2Xv>, C<Xelem>, C<gvsv> and C<const> ops is now performed
by a single C<multideref> op. It can also handle C<local>, C<exists> and
C<delete>. A non-simple index expression, such as C<[$i+1]> is still done
using C<aelem/helem>, and single-level array lookup with a small constant
index is still done using C<aelemfast>.

=back

=head1 Selected Bug Fixes

=over 4

=item *

On Win32, restoring in a child pseudo-process a variable that was
C<local()>ed in a parent pseudo-process before the C<fork> happened caused
memory corruption and a crash in the child pseudo-process (and therefore OS
process).  [perl #40565]

=item *

Calling C<write> on a format with a C<^**> field could produce a panic
in sv_chop() if there were insufficient arguments or if the variable
used to fill the field was empty.  [perl #123245]

=item *

Non-ASCII lexical sub names (use in error messages) on longer have extra
junk on the end.

=item *

The C<\@> subroutine prototype no longer flattens parenthesized arrays
(taking a reference to each element), but takes a reference to the array
itself.  [perl #47363]

=item *

A block containing nothing except a C-style C<for> loop could corrupt the
stack, causing lists outside the block to lose elements or have elements
overwritten.  This could happen with C<map { for(...){...} } ...> and with
lists containing C<do { for(...){...} }>.  [perl #123286]

=item *

C<scalar()> now propagates lvalue context, so that
C<for(scalar($#foo)) { ... }> can modify C<$#foo> through C<$_>.

=item *

C<qr/@array(?{block})/> no longer dies with "Bizarre copy of ARRAY".
[#123344]

=item *

C<eval '$variable'> in nested named subroutines would sometimes look up a
global variable even with a lexical variable in scope.

=item *

In perl 5.20.0, C<sort CORE::fake> where 'fake' is anything other than a
keyword started chopping of the last 6 characters and treating the result
as a sort sub name.  The previous behaviour of treating "CORE::fake" as a
sort sub name has been restored.  [perl #123410]

=item *

Outside of C<use utf8>, a single-character Latin-1 lexical variable is
disallowed.  The error message for it, "Can't use global $foo...", was
giving garbage instead of the variable name.

=item *

C<readline> on a nonexistent handle was causing C<${^LAST_FH}> to produce a
reference to an undefined scalar (or fail an assertion).  Now
C<${^LAST_FH}> ends up undefined.

=item *

C<(...)x...> in void context now applies scalar context to the left-hand
argument, instead of the context the current sub was called in.
[perl #123020]

=back

=head1 Acknowledgements

Perl 5.21.7 represents approximately 4 weeks of development since Perl 5.21.6
and contains approximately 97,000 lines of changes across 640 files from 30
authors.

Excluding auto-generated files, documentation and release tools, there were
approximately 26,000 lines of changes to 400 .pm, .t, .c and .h files.

Perl continues to flourish into its third decade thanks to a vibrant community
of users and developers. The following people are known to have contributed the
improvements that became Perl 5.21.7:

Aaron Crane, Aristotle Pagaltzis, Chad Granum, Chris 'BinGOs' Williams, Craig
A. Berry, Dagfinn Ilmari Mannsåker, Daniel Dragan, David Mitchell, Eric
Herman, Father Chrysostomos, H.Merijn Brand, Hugo van der Sanden, James
Raspass, Jarkko Hietaniemi, Jim Cromie, Karen Etheridge, Karl Williamson, kmx,
Lukas Mai, Matthew Horsfall, Max Maischein, Petr Písař, Ricardo Signes,
Shlomi Fish, Steffen Müller, Steve Hay, Sullivan Beck, syber, Todd Rinaldo,
Tony Cook.

The list above is almost certainly incomplete as it is automatically generated
from version control history. In particular, it does not include the names of
the (very much appreciated) contributors who reported issues to the Perl bug
tracker.

Many of the changes included in this version originated in the CPAN modules
included in Perl's core. We're grateful to the entire CPAN community for
helping Perl to flourish.

For a more complete list of all of Perl's historical contributors, please see
the F<AUTHORS> file in the Perl source distribution.

=head1 Reporting Bugs

If you find what you think is a bug, you might check the articles recently
posted to the comp.lang.perl.misc newsgroup and the perl bug database at
https://rt.perl.org/ .  There may also be information at
http://www.perl.org/ , the Perl Home Page.

If you believe you have an unreported bug, please run the L<perlbug> program
included with your release.  Be sure to trim your bug down to a tiny but
sufficient test case.  Your bug report, along with the output of C<perl -V>,
will be sent off to perlbug@perl.org to be analysed by the Perl porting team.

If the bug you are reporting has security implications, which make it
inappropriate to send to a publicly archived mailing list, then please send it
to perl5-security-report@perl.org.  This points to a closed subscription
unarchived mailing list, which includes all the core committers, who will be
able to help assess the impact of issues, figure out a resolution, and help
co-ordinate the release of patches to mitigate or fix the problem across all
platforms on which Perl is supported.  Please only use this address for
security issues in the Perl core, not for modules independently distributed on
CPAN.

=head1 SEE ALSO

The F<Changes> file for an explanation of how to view exhaustive details on
what changed.

The F<INSTALL> file for how to build Perl.

The F<README> file for general stuff.

The F<Artistic> and F<Copying> files for copyright information.

=cut
