The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

perl5276delta - what is new for perl v5.27.6

DESCRIPTION

This document describes differences between the 5.27.5 release and the 5.27.6 release.

If you are upgrading from an earlier release such as 5.27.4, first read perl5275delta, which describes differences between 5.27.4 and 5.27.5.

Core Enhancements

Initialisation of aggregate state variables

A persistent lexical array or hash variable can now be initialized, by an expression such as state @a = qw(x y z). Initialization of a list of persistent lexical variables is still not possible.

Full-size inode numbers

On platforms where inode numbers are of a type larger than perl's native integer numerical types, stat will preserve the full content of large inode numbers by returning them in the form of strings of decimal digits. Exact comparison of inode numbers can thus be achieved by comparing with eq rather than ==. Comparison with ==, and other numerical operations (which are usually meaningless on inode numbers), work as well as they did before, which is to say they fall back to floating point, and ultimately operate on a fairly useless rounded inode number if the real inode number is too big for the floating point format.

Incompatible Changes

Yada-yada is now strictly a statement

By the time of its initial stable release in Perl 5.12, the ... (yada-yada) operator was explicitly intended to serve as a statement, not an expression. However, the original implementation was confused on this point, leading to inconsistent parsing. The operator was accidentally accepted in a few situations where it did not serve as a complete statement, such as

    ... . "foo";
    ... if $a < $b;

The parsing has now been made consistent, permitting yada-yada only as a statement. Affected code can use do{...} to put a yada-yada into an arbitrary expression context.

Subroutines no longer need typeglobs

Perl 5.22.0 introduced an optimization allowing subroutines to be stored in packages as simple sub refs, not requiring a full typeglob (thus potentially saving large amounts of memeory). However, the optimization was flawed: it only applied to the main package.

This optimization has now been extended to all packages. This may break compatibility with introspection code that looks inside stashes and expects everything in them to be a typeglob.

When this optimization happens, the typeglob still notionally exists, so accessing it will cause the stash entry to be upgraded to a typeglob. The optimization does not apply to XSUBs or exported subroutines, and calling a method will undo it, since method calls cache things in typeglobs.

(This change actually happened in perl 5.27.5 but was omitted from its perldelta.)

[perl #129916] [perl #132252]

Sort algorithm can no longer be specified

Since Perl 5.8, the sort pragma has had subpragmata _mergesort, _quicksort, and _qsort that can be used to specify which algorithm perl should use to implement the sort builtin. This was always considered a dubious feature that might not last, hence the underscore spellings, and they were documented as not being portable beyond Perl 5.8. These subpragmata have now been deleted, and any attempt to use them is an error. The sort pragma otherwise remains, and the algorithm-neutral stable subpragma can be used to control sorting behaviour. [perl #119635]

Performance Enhancements

  • Many string concatenation expressions are now considerably faster, due to the introduction internally of a multiconcat opcode which combines multiple concatenations, and optionally a = or .=, into a single action. For example, apart from retrieving $s, $a and $b, this whole expression is now handled as a single op:

        $s .= "a=$a b=$b\n"

    As a special case, if the LHS of an assignment is a lexical variable or my $s, the op itself handles retrieving the lexical variable, which is faster.

    In general, the more the expression includes a mix of constant strings and variable expressions, the longer the expression, and the more it mixes together non-utf8 and utf8 strings, the more marked the performance improvement. For example on a x86_64 system, this code has been benchmarked running four times faster:

        my $s;
        my $a = "ab\x{100}cde";
        my $b = "fghij";
        my $c = "\x{101}klmn";
    
        for my $i (1..10_000_000) {
            $s = "\x{100}wxyz";
            $s .= "foo=$a bar=$b baz=$c";
        }

    In addition, sprintf expressions which have a constant format containing only %s and %% format elements, and which have a fixed number of arguments, are now also optimised into a multiconcat op.

  • Subroutines in packages no longer need to be stored in typeglobs, saving large amounts of memory. See "Subroutines no longer need typeglobs" under "Incompatible Changes", above.

Modules and Pragmata

Key highlights in this release across several modules:

Removal of use vars

The usage of use vars has been discouraged since the introduction of our in Perl 5.6.0. Where possible the usage of this pragma has now been removed from the Perl source code.

This had a slight effect (for the better) on the output of WARNING_BITS in B::Deparse.

Use of DynaLoader changed to XSLoader in many modules

XSLoader is more modern, and most modules already require perl 5.6 or greater, so no functionality is lost by switching. In some cases, we have also made changes to the local implementation that may not be reflected in the version on CPAN due to a desire to maintain more backwards compatibility.

Updated Modules and Pragmata

  • Attribute::Handlers has been upgraded from version 1.00 to 1.01.

  • attributes has been upgraded from version 0.31 to 0.32.

  • B has been upgraded from version 1.70 to 1.72.

  • B::Concise has been upgraded from version 1.002 to 1.003.

  • B::Deparse has been upgraded from version 1.43 to 1.45.

  • base has been upgraded from version 2.26 to 2.27.

  • blib has been upgraded from version 1.06 to 1.07.

  • Carp has been upgraded from version 1.43 to 1.44.

    If a package on the call stack contains a constant named ISA, Carp no longer throws a "Not a GLOB reference" error.

  • Compress::Raw::Zlib has been upgraded from version 2.074 to 2.075.

    This addresses a security vulnerability in older versions of the 'zlib' library (which is bundled with Compress-Raw-Zlib).

  • Config::Extensions has been upgraded from version 0.01 to 0.02.

  • Devel::PPPort has moved from cpan-first to perl-first maintenance

    Primary responsibility for the code in Devel::PPPort has moved into core perl. In a practical sense there should be no change except that hopefully it will stay more up to date with changes made to symbols in perl, rather than needing to be updated after the fact.

  • DynaLoader has been upgraded from version 1.42 to 1.44.

  • experimental has been upgraded from version 0.016 to 0.017.

  • ExtUtils::CBuilder has been upgraded from version 0.280228 to 0.280229.

  • ExtUtils::Embed has been upgraded from version 1.34 to 1.35.

  • ExtUtils::Miniperl has been upgraded from version 1.06 to 1.07.

  • ExtUtils::ParseXS has been upgraded from version 3.35 to 3.36.

  • ExtUtils::Typemaps has been upgraded from version 3.35 to 3.36.

  • ExtUtils::XSSymSet has been upgraded from version 1.3 to 1.4.

  • fields has been upgraded from version 2.23 to 2.24.

  • File::Copy has been upgraded from version 2.32 to 2.33. It will now use Time::HiRes utime where available (perl #132401).

  • File::Spec has been upgraded from version 3.68 to 3.70.

  • File::stat has been upgraded from version 1.07 to 1.08.

  • FileCache has been upgraded from version 1.09 to 1.10.

  • Filter::Simple has been upgraded from version 0.94 to 0.95.

  • Hash::Util::FieldHash has been upgraded from version 1.19 to 1.20.

  • I18N::Langinfo has been upgraded from version 0.14 to 0.15.

  • I18N::LangTags has been upgraded from version 0.42 to 0.43.

  • The libnet distribution has been upgraded from version 3.10 to 3.11.

  • Locale::Maketext has been upgraded from version 1.28 to 1.29.

  • Module::CoreList has been upgraded from version 5.20171020 to 5.20171120.

  • Net::Ping has been upgraded from version 2.55 to 2.62.

  • ODBM_File has been upgraded from version 1.14 to 1.15.

  • Opcode has been upgraded from version 1.40 to 1.41.

  • Pod::Html has been upgraded from version 1.2202 to 1.2203.

  • POSIX has been upgraded from version 1.78 to 1.80.

  • re has been upgraded from version 0.35 to 0.36.

  • SelfLoader has been upgraded from version 1.24 to 1.25.

  • Socket has been upgraded from version 2.020_03 to 2.020_04.

  • sort has been upgraded from version 2.03 to 2.04.

  • Storable has been upgraded from version 2.64 to 2.65.

  • Test has been upgraded from version 1.30 to 1.31.

  • Test::Simple has been upgraded from version 1.302103 to 1.302111.

  • threads has been upgraded from version 2.18 to 2.19.

  • Tie::Array has been upgraded from version 1.06 to 1.07.

  • Tie::StdHandle has been upgraded from version 4.4 to 4.5.

  • Time::gmtime has been upgraded from version 1.03 to 1.04.

  • Time::HiRes has been upgraded from version 1.9746 to 1.9747.

  • Time::localtime has been upgraded from version 1.02 to 1.03.

  • Unicode::Collate has been upgraded from version 1.19 to 1.23.

  • Unicode::Normalize has been upgraded from version 1.25 to 1.26.

  • User::grent has been upgraded from version 1.01 to 1.02.

  • User::pwent has been upgraded from version 1.00 to 1.01.

  • VMS::DCLsym has been upgraded from version 1.08 to 1.09.

  • VMS::Stdio has been upgraded from version 2.42 to 2.44.

  • warnings has been upgraded from version 1.37 to 1.38.

  • XS::Typemap has been upgraded from version 0.15 to 0.16.

  • XSLoader has been upgraded from version 0.27 to 0.28.

Documentation

Changes to Existing Documentation

We have attempted to update the documentation to reflect the changes listed in this document. If you find any we have missed, send email to perlbug@perl.org.

Additionally, the following selected changes have been made:

  • "Variable length lookbehind not implemented in regex m/%s/" in perldiag

    This now gives more ideas as to workarounds to the issue that was introduced in Perl 5.18 (but not documented explicitly in its perldelta) for the fact that some Unicode /i rules cause a few sequences such as

     (?<!st)

    to be considered variable length, and hence disallowed.

  • "Use of state $_ is experimental" in perldiag

    This entry has been removed, as the experimental support of this construct was removed in perl 5.24.0.

  • The section on reference counting in perlguts has been heavily revised, to describe references in the way a programmer needs to think about them rather than in terms of the physical data structures.

  • The section "Truth and Falsehood" in perlsyn has been removed from that document, where it didn't belong, and merged into the existing paragraph on the same topic in perldata.

  • The description of the x operator in perlop has been clarified. [perl #132460]

  • perluniprops has been updated to note that \p{Word} now includes code points matching the \p{Join_Control} property. The change to the property was made in Perl 5.18, but not documented until now. There are currently only two code points that match this property U+200C (ZERO WIDTH NON-JOINER) and U+200D (ZERO WIDTH JOINER).

  • The entry for $+ in perlvar has been expanded upon to describe handling of multiply-named capturing groups.

  • perlop has been updated to note that qw's whitespace rules differ from that of split's in that only ASCII whitespace is used.

  • POSIX has been updated with some more cautions about using locale-specific functions in threaded applications.

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 perldiag.

Changes to Existing Diagnostics

  • The diagnostic Initialization of state variables in list context currently forbidden has changed to Initialization of state variables in list currently forbidden, because list-context initialization of single aggregate state variables is now permitted.

Utility Changes

perlbug

  • --help and --version options have been added.

Configuration and Compilation

C89 requirement

Perl has been documented as requiring a C89 compiler to build since October 1998. A variety of simplifications have now been made to Perl's internals to rely on the features specified by the C89 standard. We believe that this internal change hasn't altered the set of platforms that Perl builds on, but please report a bug if Perl now has new problems building on your platform.

New probes
HAS_BUILTIN_ADD_OVERFLOW
HAS_BUILTIN_MUL_OVERFLOW
HAS_BUILTIN_SUB_OVERFLOW
HAS_THREAD_SAFE_NL_LANGINFO_L
HAS_LOCALECONV_L
HAS_MBRLEN
HAS_MBRTOWC
HAS_MEMRCHR
HAS_NANOSLEEP
HAS_STRNLEN
HAS_STRTOLD_L
I_WCHAR

Packaging

For the past few years we have released perl using three different archive formats: bzip (.bz2), LZMA2 (.xz) and gzip (.gz). Since xz compresses better and decompresses faster, and gzip is more compatible and uses less memory, we have dropped the .bz2 archive format with this release. (If this poses a problem, do let us know; see "Reporting Bugs", below.)

Platform Support

Discontinued Platforms

PowerUX / Power MAX OS

Compiler hints and other support for these apparently long-defunct platforms has been removed.

Platform-Specific Notes

Windows

Visual C++ compiler version detection has been improved to work on non-English language systems.

Internal Changes

  • A new optimisation phase has been added to the compiler, optimize_optree(), which does a top-down scan of a complete optree just before the peephole optimiser is run. This phase is not currently hookable.

  • An OP_MULTICONCAT op has been added. At optimize_optree() time, a chain of OP_CONCAT and OP_CONST ops, together optionally with an OP_STRINGIFY and/or OP_SASSIGN, are combined into a single OP_MULTICONCAT op. The op is of type UNOP_AUX, and the aux array contains the argument count, plus a pointer to a constant string and a set of segment lengths. For example with

        my $x = "foo=$foo, bar=$bar\n";

    the constant string would be "foo=, bar=\n" and the segment lengths would be (4,6,1). If the string contains characters such as \x80, whose representation changes under utf8, two sets of strings plus lengths are precomputed and stored.

  • Direct access to PL_keyword_plugin is not safe in the presence of multithreading. A new wrap_keyword_plugin function has been added to allow XS modules to safely define custom keywords even when loaded from a thread, analogous to PL_check / wrap_op_checker.

Selected Bug Fixes

  • stat(), lstat(), and file test operators now fail if given a filename containing a nul character, in the same way that open() already fails.

  • stat(), lstat(), and file test operators now reliably set $! when failing due to being applied to a closed or otherwise invalid file handle.

  • File test operators for Unix permission bits that don't exist on a particular platform, such as -k (sticky bit) on Windows, now check that the file being tested exists before returning the blanket false result, and yield the appropriate errors if the argument doesn't refer to a file.

  • The in-place reverse optimisation now correctly strengthens weak references using the sv_rvunweaken() API function.

  • Fixed a read before buffer when parsing a range starting with \N{} at the beginning of the character set for the transliteration operator. [perl #132245]

  • Fixed a leaked SV when parsing an empty \N{} at compile-time. [perl #132245]

  • Calling do $path on a directory or block device now yields a meaningful error code in $!. [perl #125774]

  • Regexp substitution using an overloaded replacement value that provides a tainted stringification now correctly taints the resulting string. [perl #115266]

  • Lexical sub declarations in do blocks such as do { my sub lex; 123 } could corrupt the stack, erasing items already on the stack in the enclosing statement. This has been fixed. [perl #132442]

Errata From Previous Releases

Acknowledgements

Perl 5.27.6 represents approximately 4 weeks of development since Perl 5.27.5 and contains approximately 110,000 lines of changes across 1,100 files from 30 authors.

Excluding auto-generated files, documentation and release tools, there were approximately 20,000 lines of changes to 430 .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.27.6:

Aaron Crane, Andrew Fresh, Ask Bjørn Hansen, Chris 'BinGOs' Williams, Craig A. Berry, Dagfinn Ilmari Mannsåker, Daniel Dragan, David Cantrell, David Mitchell, Dominic Hargreaves, Father Chrysostomos, Harald Jörg, H.Merijn Brand, James E Keenan, Jarkko Hietaniemi, J. Nick Koston, John Lightsey, Karen Etheridge, Karl Williamson, Lukas Mai, Matthew Horsfall, Nicolas R., Paul Marquess, Sawyer X, Slaven Rezic, Steve Hay, Todd Rinaldo, Tony Cook, 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 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.

Give Thanks

If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, you can do so by running the perlthanks program:

    perlthanks

This will send an email to the Perl 5 Porters list with your show of thanks.

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.