NAME

perldelta - what is new for perl v5.26.0

DESCRIPTION

This document describes the differences between the 5.24.0 release and the 5.26.0 release.

Core Enhancements

New regular expression modifier /xx

Specifying two x characters to modify a regular expression pattern does everything that a single one does, but additionally TAB and SPACE characters within a bracketed character class are generally ignored and can be added to improve readability, like /[ ^ A-Z d-f p-x ]/xx. Details are at "/x and /xx" in perlre.

New Hash Function For 64-bit Builds

We have switched to a hybrid hash function to better balance performance for short and long keys.

For short keys, 16 bytes and under, we use an optimised variant of One At A Time Hard, and for longer keys we use Siphash 1-3. For very long keys this is a big improvement in performance. For shorter keys there is a modest improvement.

Indented Here-documents

This adds a new modifier '~' to here-docs that tells the parser that it should look for /^\s*$DELIM\n/ as the closing delimiter.

These syntaxes are all supported:

    <<~EOF;
    <<~\EOF;
    <<~'EOF';
    <<~"EOF";
    <<~`EOF`;
    <<~ 'EOF';
    <<~ "EOF";
    <<~ `EOF`;

The '~' modifier will strip, from each line in the here-doc, the same whitespace that appears before the delimiter.

Newlines will be copied as is, and lines that don't include the proper beginning whitespace will cause perl to croak.

For example:

    if (1) {
      print <<~EOF;
        Hello there
        EOF
    }

prints "Hello there\n" with no leading whitespace.

'.' and @INC

Perl now provides a way to build perl without . in @INC by default. If you want this feature, you can build with -Ddefault_inc_excludes_dot

Because the testing / make process for perl modules do not function well with . missing from @INC, Perl now supports the environment variable PERL_USE_UNSAFE_INC=1 which makes Perl behave as it previously did, returning . to @INC in all child processes.

WARNING: PERL_USE_UNSAFE_INC has been provided during the perl 5.25 development cycle and is not guaranteed to function in perl 5.26.

create a safer utf8_hop() called utf8_hop_safe()

Unlike utf8_hop(), utf8_hop_safe() won't navigate before the beginning or after the end of the supplied buffer.

@{^CAPTURE}, %{^CAPTURE}, and %{^CAPTURE_ALL}

@{^CAPTURE} exposes the capture buffers of the last match as an array. So $1 is ${^CAPTURE}[0].

%{^CAPTURE} is the equivalent to %+ (ie named captures)

%{^CAPTURE_ALL} is the equivalent to %- (ie all named captures).

Unicode 9.0 is now supported

A list of changes is at http://www.unicode.org/versions/Unicode9.0.0/. Modules that are shipped with core Perl but not maintained by p5p do not necessarily support Unicode 9.0. Unicode::Normalize does work on 9.0.

Use of \p{script} uses the improved Script_Extensions property

Unicode 6.0 introduced an improved form of the Script (sc) property, and called it Script_Extensions (scx). As of now, Perl uses this improved version when a property is specified as just \p{script}. The meaning of compound forms, like \p{sc=script} are unchanged. This should make programs be more accurate when determining if a character is used in a given script, but there is a slight chance of breakage for programs that very specifically needed the old behavior. See "Scripts" in perlunicode.

Declaring a reference to a variable

As an experimental feature, Perl now allows the referencing operator to come after my(), state(), our(), or local(). This syntax must be enabled with use feature 'declared_refs'. It is experimental, and will warn by default unless no warnings 'experimental::refaliasing' is in effect. It is intended mainly for use in assignments to references. For example:

    use experimental 'refaliasing', 'declared_refs';
    my \$a = \$b;

See "Assigning to References" in perlref for slightly more detail.

Perl can now do default collation in UTF-8 locales on platforms that support it

Some platforms natively do a reasonable job of collating and sorting in UTF-8 locales. Perl now works with those. For portability and full control, Unicode::Collate is still recommended, but now you may not need to do anything special to get good-enough results, depending on your application. See "Category LC_COLLATE: Collation: Text Comparisons and Sorting" in perllocale.

Better locale collation of strings containing embedded NUL characters

In locales that have multi-level character weights, these are now ignored at the higher priority ones. There are still some gotchas in some strings, though. See "Collation of strings containing embedded NUL characters" in perllocale.

Lexical subroutines are no longer experimental

Using the lexical_subs feature no longer emits a warning. Existing code that disables the experimental::lexical_subs warning category that the feature previously used will continue to work. The lexical_subs feature has no effect; all Perl code can use lexical subroutines, regardless of what feature declarations are in scope.

CORE subroutines for hash and array functions callable via reference

The hash and array functions in the CORE namespace--keys, each, values, push, pop, shift, unshift and splice--, can now be called with ampersand syntax (&CORE::keys(\%hash) and via reference (my $k = \&CORE::keys; $k->(\%hash)). Previously they could only be used when inlined.

POSIX::tmpnam() has been removed

The fundamentally unsafe tmpnam() interface was deprecated in Perl 5.22.0 and has now been removed. In its place you can use for example the File::Temp interfaces.

require ::Foo::Bar is now illegal.

Formerly, require ::Foo::Bar would try to read /Foo/Bar.pm. Now any bareword require which starts with a double colon dies instead.

Unescaped literal "{" characters in regular expression patterns are no longer permissible

You have to now say something like "\{" or "[{]" to specify to match a LEFT CURLY BRACKET. This will allow future extensions to the language. This restriction is not enforced, nor are there current plans to enforce it, if the "{" is the first character in the pattern.

These have been deprecated since v5.16, with a deprecation message displayed starting in v5.22.

Literal control character variable names are no longer permissible

A variable name may no longer contain a literal control character under any circumstances. These previously were allowed in single-character names on ASCII platforms, but have been deprecated there since Perl v5.20. This affects things like $\cT, where \cT is a literal control (such as a NAK or NEGATIVE ACKNOWLEDGE character) in the source code.

NBSP is no longer permissible in \N{...}

The name of a character may no longer contain non-breaking spaces. It has been deprecated to do so since Perl v5.22.

Security

Remove current dir (.) from @INC

For security reasons, @INC no longer contains the default directory (.).

"Escaped" colons and relative paths in PATH

On Unix systems, Perl treats any relative paths in the PATH environment variable as tainted when starting a new process. Previously, it was allowing a backslash to escape a colon (unlike the OS), consequently allowing relative paths to be considered safe if the PATH was set to something like /\:.. The check has been fixed to treat . as tainted in that example.

-Di switch is now required for PerlIO debugging output

Previously PerlIO debugging output would be sent to the file specified by the PERLIO_DEBUG environment variable if perl wasn't running setuid and the -T or -t switches hadn't been parsed yet.

If perl performed output at a point where it hadn't yet parsed its switches this could result in perl creating or overwriting the file named by PERLIO_DEBUG even when the -T switch had been supplied.

Perl now requires the -Di switch to produce PerlIO debugging output. By default this is written to stderr, but can optionally be redirected to a file by setting the PERLIO_DEBUG environment variable.

If perl is running setuid or the -T switch has supplied PERLIO_DEBUG is ignored and the debugging output is sent to stderr as for any other -D switch.

Incompatible Changes

${^ENCODING} has been removed

Consequently, the encoding pragma's default mode is no longer supported. If you still need to write your source code in encodings other than UTF-8, use a source filter such as Filter::Encoding on CPAN or encoding's Filter option.

scalar(%hash) return signature changed

The value returned for scalar(%hash) will no longer show information about the buckets allocated in the hash. It will simply return the count of used keys. It is thus equivalent to 0+keys(%hash).

A form of backwards compatibility is provided via Hash::Util::bucket_ratio() which provides the same behavior as scalar(%hash) provided prior to Perl 5.25.

keys returned from an lvalue subroutine

keys returned from an lvalue subroutine can no longer be assigned to in list context.

    sub foo : lvalue { keys(%INC) }
    (foo) = 3; # death
    sub bar : lvalue { keys(@_) }
    (bar) = 3; # also an error

This makes the lvalue sub case consistent with (keys %hash) = ... and (keys @_) = ..., which are also errors. [perl #128187]

Deprecations

String delimiters that aren't stand-alone graphemes are now deprecated

In order for Perl to eventually allow string delimiters to be Unicode grapheme clusters (which look like a single character, but may be a sequence of several ones), we have to stop allowing a single char delimiter that isn't a grapheme by itself. These are unlikely to exist in actual code, as they would typically display as attached to the character in front of them.

Performance Enhancements

Modules and Pragmata

Updated Modules and Pragmata

Documentation

New Documentation

perldeprecation

This file documents all upcoming deprecations, and some of the deprecations which already have been removed. The purpose of this documentation is two-fold: document what will disappear, and by which version, and serve as a guide for people dealing with code which has features that no longer work after an upgrade of their perl.

Changes to Existing Documentation

perlcall

perlcommunity

perldata

perldelta

perldiag

perlexperiment

perlfunc

perlguts

perlhack

perlinterp

perllocale

perlmodinstall

perlmodlib

perlnewmod

perlobj

perlootut

perlop

perlre

perlsec

perlref

perltie

perlunicode

perlvar

Diagnostics

New Diagnostics

New Errors

New Warnings

Changes to Existing Diagnostics

Utility Changes

c2ph and pstruct

Porting/pod_lib.pl

Porting/sync-with-cpan

perf/benchmarks

Porting/checkAUTHORS.pl

t/porting/regen.t

utils/h2xs.PL

perlbug

Configuration and Compilation

Testing

Platform Support

New Platforms

NetBSD/VAX

Perl now compiles under NetBSD on VAX machines. However, it's not possible for that platform to implement floating-point infinities and NaNs compatibly with most modern systems, which implement the IEEE-754 floating point standard. The hexadecimal floating point (0x...p[+-]n literals, printf %a) is not implemented, either. The make test passes 98% of tests.

Platform-Specific Notes

Darwin

don't treat -Dprefix=/usr as special, instead require an extra option -Ddarwin_distribution to produce the same results.

POSIX

Finish removing POSIX deprecated functions.

OS X

OS X El Capitan doesn't implement the clock_gettime() or clock_getres() APIs, emulate them as necessary.

macOS

Deprecated syscall(2) on macOS 10.12.

EBCDIC

Several tests have been updated to work (or be skipped) on EBCDIC platforms.

HP-UX

Net::Ping UDP test is skipped on HP-UX.

Hurd

The hints for Hurd have been improved enabling malloc wrap and reporting the GNU libc used (previously it was an empty string when reported).

VAX

VAX floating point formats are now supported.

VMS
Windows
Win32
VMS And Win32

Fix some breakage, add 'undef' value for default_inc_excludes_dot in build scripts.

Linux

Drop support for Linux a.out Linux has used ELF for over twenty years.

OpenBSD 6

OpenBSD 6 still does not support returning pid, gid or uid with SA_SIGINFO. Make sure this is accounted for.

FreeBSD

t/uni/overload.t: Skip hanging test on FreeBSD.

Internal Changes

Selected Bug Fixes

Known Problems

Errata From Previous Releases

Obituary

Jon Portnoy (AVENJ), a prolific Perl author and admired Gentoo community member, has passed away on August 10, 2016. He will be remembered and missed by all those with which he came in contact and enriched with his intellect, wit, and spirit.

It is with great sadness we also note Kip Hampton's passing.. Probably best known as the author of the Perl & XML column on XML.com, he was a core contributor to AxKit, an XML server platform that became an Apache Foundation project. He was a frequent speaker in the early days at OSCON, and most recently at YAPC::NA in Madison. He was frequently on irc.perl.org as `ubu`, generally in the #axkit-dahut community, the group responsible for YAPC::NA Asheville in 2011.

Kip and his constant contributions to the community will be greatly missed.

Acknowledgements

Perl 5.26.0 represents approximately 12 months of development since Perl 5.24.0 and contains approximately 370,000 lines of changes across 2,600 files from 86 authors.

Excluding auto-generated files, documentation and release tools, there were approximately 230,000 lines of changes to 1,800 .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.24.1:

Aaron Crane, Abigail, Ævar Arnfjörð Bjarmason, Alex Vandiver, Andreas König, Andreas Voegele, Andrew Fresh, Andy Lester, Aristotle Pagaltzis, Chad Granum, Chase Whitener, Chris 'BinGOs' Williams, Chris Lamb, Christian Hansen, Christian Millour, Colin Newell, Craig A. Berry, Dagfinn Ilmari Mannsåker, Dan Collins, Daniel Dragan, Dave Cross, Dave Rolsky, David Golden, David H. Gutteridge, David Mitchell, Dominic Hargreaves, Doug Bell, E. Choroba, Ed Avis, Father Chrysostomos, François Perrad, Hauke D, H.Merijn Brand, Hugo van der Sanden, Ivan Pozdeev, James E Keenan, James Raspass, Jarkko Hietaniemi, Jerry D. Hedden, Jim Cromie, J. Nick Koston, John Lightsey, Karen Etheridge, Karl Williamson, Leon Timmermans, Lukas Mai, Matthew Horsfall, Maxwell Carey, Misty De Meo, Neil Bowers, Nicholas Clark, Nicolas R., Niko Tyni, Pali, Paul Marquess, Peter Avalos, Petr Písař, Pino Toscano, Rafael Garcia-Suarez, Reini Urban, Renee Baecker, Ricardo Signes, Richard Levitte, Rick Delaney, Salvador Fandiño, Samuel Thibault, Sawyer X, Sébastien Aperghis-Tramoni, Sergey Aleynikov, Shlomi Fish, Smylers, Stefan Seifert, Steffen Müller, Stevan Little, Steve Hay, Steven Humphrey, Sullivan Beck, Theo Buehler, Thomas Sibley, Todd Rinaldo, Tomasz Konojacki, Tony Cook, Unicode Consortium, Yaroslav Kuzmin, Yves Orton, Zefram.

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 AUTHORS file in the Perl source distribution.

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 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 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 see "SECURITY VULNERABILITY CONTACT INFORMATION" in perlsec for details of how to report the issue.

SEE ALSO

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

The INSTALL file for how to build Perl.

The README file for general stuff.

The Artistic and Copying files for copyright information.