NAME

perldelta - what is new for perl v5.45.5

DESCRIPTION

This document describes differences between the 5.45.4 release and the 5.45.5 release.

If you are upgrading from an earlier release such as 5.45.3, first read perl5454delta, which describes differences between 5.45.3 and 5.45.4.

Performance Enhancements

  • Case-insensitive literal alternatives such as foo|bar|a_word|_qux can compile into a single trie again. Characters that do not participate in Unicode case folding can join neighboring folded literals after the optimizer records their fixed substrings. [GH #19953]

  • Non-folded trie matching against native byte strings now consumes a character's encoded octets in one iteration. This reduces reader bookkeeping when the character requires two UTF-8 or UTF-EBCDIC octets.

  • The Aho-Corasick regex scanner uses Boyer-Moore-Horspool shift tables to skip positions where no literal alternative can start. It can also skip repeated blocks of octets that cannot start an alternative. These filters apply to eligible case-sensitive literals, with separate shift tables for Latin-1 and UTF-8 targets.

    Eligible case-insensitive literal alternatives use a start-octet map that includes their possible folds. They do not use the shift tables, because folding can change encoded lengths. Locale-dependent folding uses the existing scanner.

    The scanner also reduces the cost of tracking match positions, especially for case-sensitive matching against non-UTF-8 targets, and avoids repeated alignment checks while finding a rejected block of octets.

  • The isa operator now does a cached lookup of the isa method, improving performance when that isa() method happens to be UNIVERSAL::isa. [GH #24997]

Modules and Pragmata

Updated Modules and Pragmata

  • B::Concise has been upgraded from version 1.012 to 1.013.

  • DB_File has been upgraded from version 1.860 to 1.861.

  • Devel::PPPort has been upgraded from version 3.75 to 3.76.

  • Encode has been upgraded from version 3.24 to 3.25.

  • encoding has been upgraded from version 3.00 to 3.01.

  • libnet has been upgraded from version 3.15 to 3.16.

  • Module::CoreList has been upgraded from version 5.20261022 to 5.20261119.

  • Test::Simple has been upgraded from version 1.302225 to 1.302226.

  • Win32 has been upgraded from version 0.64 to 0.65.

  • XS::APItest has been upgraded from version 1.52 to 1.53.

Configuration and Compilation

  • GCC and Clang configuration probes now work with -Werror when detecting library functions, the size of long double, supported compiler options, time headers, memory-mapping and shared-memory return types, and the in-memory representation of floating-point zero.

  • Fix some build noise and technical undefined behaviour with -Duselongdouble builds on ARM64:

    • Configure would detect double format strings rather than the correct long double format string as the format string for NV when NV was long double, resulting in -Wformat warnings.

    • perl.h would disable USE_LONG_DOUBLE when double and long double were the same size leaving NV as long double. This would result in calls to a C library function that expected a double pointer being supplied a <long double> pointer, resulting in type mismatch warnings.

Testing

  • t/TEST and t/harness now run generated tests

    t/TEST and t/harness are the programs which are the engines underneath make test and make test_harness. Up till now the list of test files that they run was composed by examination of MANIFEST. However in 2020 the test files for the Devel-PPPort library (shipped with core in the dist/Devel-PPPort directory) were overhauled such that they were composed during that library's own build process from data files found underneath that directory. As such they were no longer listed as test files in MANIFEST -- but t/TEST and t/harness were not updated to account for the possibility of generated tests in addition to "MANIFEST-listed" tests. This was not noticed until [GH #24855].

    This has been corrected. Testers will now see dist/Devel-PPPort/t/*.t test files being run as part of make test and make test_harness. In addition, t/porting/test_testlist.t now verifies that generated tests are being run and more thoroughly exercises the various ways in which running the test suite can be triggered.

Platform Support

Platform-Specific Notes

  • macOS (Darwin)

    Given GCC 3.3 20030304 (Apple Computer, Inc. build 1435) from the June 2003 GCC update or newer, it should be possible to build current Perl on Mac OS X 10.2 Jaguar (Darwin 6) once again.

Internal Changes

  • CODE magic for Magic v2

    A new sub-type of magic has been added, designed to be applied to subroutines (i.e. SVs having the type SVt_PVCV). This magic sub-type has various trigger functions relating to compile-time or runtime management of the subroutine to which it is attached.

    For more details, see "struct CodeMagicFunctions" in perlapi.

  • save_scalar_flags

    Added a new function analogous to save_aelem_flags and save_helem_flags, to have more control over saving scalars.

Selected Bug Fixes

  • Resolving a deferred array or hash element no longer frees the element when the deferred alias holds the container's last reference. Assigning through a deferred array element that can no longer extend its array no longer leaks the array. [GH #25038]

  • Various operations in the parser have now been made deterministic where they used to be at the mercy of the C compiler. Parser errors and warnings should now be emitted in consistent order in all build contexts. Line attribution for the implicit statements in a use no longer depends on C compiler argument evaluation order.

  • A case-insensitive regex trie no longer accepts a word ending partway through an input character's fold. For example, /s|zoo/iu no longer matches a sharp-s, whose full fold is ss. Later alternatives are tried in order.

  • A folded regex trie now updates its minimum and maximum lengths independently. An alternative which changes both bounds could previously cause a valid match to be missed or an assertion failure during Aho-Corasick scanning.

  • Case-insensitive trie prefix extraction no longer splits a multi-character fold between regex nodes. For example, a UTF-8 flagged ssx|sy pattern under /iu now matches "\x{df}x".

  • A case-insensitive regular expression with a folded literal start class could loop indefinitely when searching at the end of a UTF-8 string. This could occur on a subsequent /g match after a successful match.

    [GH #24934]

  • "caller" in perlfunc is better able to identify the correct call site when multiple branches of an if/elsif/else chain call the same function.

  • B::Xref is able to use line numbers stored within nulled COPs. [GH #7947]

  • Perl 5.44.0 introduced some internal changes that broke uses of substr when the string argument it is operating on was itself a special lvalue scalar created by another substr call. This would cause debugging assertions or invalid free() crashes from code that had a structure such as the following examples:

    my $ref = \substr($str, $offset);
    substr($$ref, 0, 1, "replacement");

    substr(substr($str, $offset), 0, 1, "replacement");

    This bug has now been fixed. [GH #24933]

  • Properly initialize ${^UTF8CACHE} in new threads

    Previously the UTF-8 cache wasn't enabled in new threads, leading to performance issues.

  • The isa operator now calls get magic on its left argument before checking if that value is a reference and what it is a reference to. [GH #24997]

  • PL_sv_zero, introduced in 5.28, has a zero numeric value and a "0" string value. Its flags did not indicate which value should be treated as authoritative when serializing or encoding to an external format. This could lead to what was originally a numerical return value being output as the string representation instead, which might not have the same meaning (e.g. in JSON).

    The flags on PL_sv_zero have been modified so that it appears to have been created as a number and then later gained a string representation. This change is intended to make it easier for serialization modules to output 0 rather than "0", provided that such modules actually do differentiate between "created as number" and "created as string".

  • Various bugfixes to foreach loops

    Perl 5.44.0 expanded the ability of foreach loops to make use of reference aliasing when using multiple loop iterator variables. Several small bugs were found when these are combined, and have been fixed in this release.

    • foreach loop with refaliasing crashes when run a second time

      [GH #25051]

    • Multivariable foreach with more than 32 variables confuses which ones are refaliases

      [GH #25055]

    • foreach with refaliasing fails to run magic

      [GH #25056]

    Perl 5.44.0 also added internal optimisations on multivariable foreach loops that call the builtin::indexed function and assign the resulting list of index / value pairs into two iterator variables. Two bugs were found when these are combined, and have been fixed in this release:

    • foreach with indexed and reverse assigns indexes backwards

      [GH #25052]

    • foreach with indexed performs aliasing rather than copying values

      [GH #25053]

    Finally, a bug was found when both refaliasing and builtin::indexed are combined in a multivariable foreach loop, and has now been fixed:

    • foreach with refaliasing and indexed crashes

      foreach my ( $idx, \@arr ) ( indexed @list_of_arefs ) {
          say "Array number [$idx] contains <@arr>";
      }

      [GH #24999]

Acknowledgements

Perl 5.45.5 represents approximately 4 weeks of development since Perl 5.45.4 and contains approximately 14,000 lines of changes across 400 files from 17 authors.

Excluding auto-generated files, documentation and release tools, there were approximately 9,200 lines of changes to 320 .pm, .t, .c and .h files.

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

Chad Granum, Chris 'BinGOs' Williams, Dan Kogai, David Mitchell, Eric Herman, Firas Khalil Khana, James E Keenan, Jan Dubois, Karl Williamson, Leon Timmermans, Nikolay Shaplov, Paul Evans, Paul Marquess, Philippe Bruhat (BooK), Richard Leach, Sevan Janiyan, Tony Cook, Yves Orton.

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.

The Perl Core Development Fund, managed by the Perl and Raku Foundation, financially supports the work of several core developers. https://perlfoundation.org/perl-core-development-fund.html

During the development cycle leading up to Perl 5.46, the following organizations each contributed the equivalent of one or more months of full-time core developer work to the Perl Core Development Fund:

DuckDuckGo.

We would like to thank them here for their support to the continued development of Perl.

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://github.com/Perl/perl5/issues. There may also be information at https://www.perl.org/, the Perl Home Page.

If you believe you have an unreported bug, please open an issue at https://github.com/Perl/perl5/issues. Be sure to trim your bug down to a tiny but sufficient test case.

If the bug you are reporting has security implications which make it inappropriate to send to a public issue tracker, 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.