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

NAME

perl5377delta - what is new for perl v5.37.7

DESCRIPTION

This document describes differences between the 5.37.6 release and the 5.37.7 release.

If you are upgrading from an earlier release such as 5.37.5, first read perl5376delta, which describes differences between 5.37.5 and 5.37.6.

Core Enhancements

Defined-or and logical-or assignment default expressions to signatures

The default expression for a subroutine signature parameter can now be assigned using the //= or ||= operators, to apply the defaults whenever the caller provided an undefined or false value (respectively), rather than simply when the parameter is missing entirely. For more detail see the documentation in perlsub.

@INC Hook Enhancements and $INC and INCDIR

The internals for @INC hooks have been hardened to handle various edge cases and should no longer segfault or throw assert failures when hooks modify @INC during a require operation. As part of this we now ensure that any given hook is executed at most once during a require call, and that any duplicate directories do not trigger additional directory probes.

To provide developers more control over dynamic module lookup, a new hook method INCDIR is now supported. An object supporting this method may be injected into the @INC array, and when it is encountered in the module search process it will be executed, just like how INC hooks are executed, and its return value used as a list of directories to search for the module. Returning an empty list acts as a no-op. Note that since any references returned by this hook will be stringified and used as strings, you may not return a hook to be executed later via this API.

When an @INC hook (either INC or INCDIR) is called during require, the $INC variable will be localized to be the value of the index of @INC that the hook came from. If the hook wishes to override what the "next" index in @INC should be it may update $INC to be one less than the desired index (undef is equivalent to -1). This allows an @INC hook to completely rewrite the @INC array and have perl restart its directory probes from the beginning of @INC.

Blessed CODE references in @INC that do not support the INC or INCDIR methods will no longer trigger an exception, and instead will be treated the same as unblessed coderefs are, and executed as though they were an INC hook.

Forbidden control flow out of defer or finally now detected at compile-time

It is forbidden to attempt to leave a defer or finally block by means of control flow such as return or goto. Previous versions of perl could only detect this when actually attempted at runtime.

This version of perl adds compile-time detection for many cases that can be statically determined. This may mean that code which compiled successfully on a previous version of perl is now reported as a compile-time error with this one. This only happens in cases where it would have been an error to actually execute the code anyway; the error simply happens at an earlier time.

Modules and Pragmata

Updated Modules and Pragmata

  • B::Deparse has been upgraded from version 1.71 to 1.72.

  • experimental has been upgraded from version 0.029 to 0.030.

  • ExtUtils::Miniperl has been upgraded from version 1.12 to 1.13.

  • ExtUtils::ParseXS has been upgraded from version 3.48 to 3.49.

  • ExtUtils::Typemaps has been upgraded from version 3.48 to 3.49.

  • feature has been upgraded from version 1.77 to 1.78.

  • File::Glob has been upgraded from version 1.38 to 1.39.

  • File::Spec has been upgraded from version 3.86 to 3.88.

  • Module::CoreList has been upgraded from version 5.20221120 to 5.20221220.

  • Opcode has been upgraded from version 1.62 to 1.63.

  • parent has been upgraded from version 0.238 to 0.239.

  • Pod::Html has been upgraded from version 1.33 to 1.34. Three auxiliary subroutines previously importable from Pod::Html must now be imported from Pod::Html::Util.

  • podlators has been upgraded from version 4.14 to 5.00.

  • POSIX has been upgraded from version 2.08 to 2.10. All fields known to the platform in localeconv(3) are now returned by "localeconv" in POSIX. Previously, empty string fields and numeric fields that aren't applicable to the current locale were omitted.

  • threads has been upgraded from version 2.32 to 2.33.

  • XS::APItest has been upgraded from version 1.27 to 1.28.

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.

New Diagnostics

New Errors

Changes to Existing Diagnostics

  • The error message that is produced when a require or use statement fails has been changed. It used to contain the words @INC contains:, and it used to show the state of @INC *after* the require had completed and failed. The error message has been changed to say @INC entries checked: and to reflect the actual directories or hooks that were executed during the require statement. For example:

        perl -e'push @INC, sub {@INC=()}; eval "require Frobnitz"
            or die $@'
        Can't locate Frobnitz.pm in @INC (you may need to install the
        Frobnitz module) (@INC contains:) at (eval 1) line 1.

    Will change to (with some output elided for clarity):

        perl -e'push @INC, sub {@INC=()}; eval "require Frobnitz"
            or die $@'
        Can't locate Frobnitz.pm in @INC (you may need to install the
        Frobnitz module) (@INC entries checked:
        .../site_perl/5.37.7/x86_64-linux .../site_perl/5.37.7
        .../5.37.7/x86_64-linux .../5.37.7 CODE(0x562745e684b8))
        at (eval 1) line 1.

    thus showing the actual directories checked. Code that checks for @INC contains: in error messages should be hardened against any future wording changes between the @INC and :, for instance use qr/\@INC[ \w]+:/ instead of using qr/\@INC contains:/ or qr/\@INC entries checked:/ in tests as this will ensure both forward and backward compatibility.

Testing

Tests were added and changed to reflect the other additions and changes in this release.

Internal Changes

  • The regex engine compilation code was split up into smaller sized compilation units. No functionality changes were made. This was just to make it easier to maintain the codebase.

Selected Bug Fixes

  • Correctly handle OP_ANONCODE ops generated by CPAN modules that don't include the OPf_REF flag when propagating lvalue context. [GH #20532]

  • POSIX::strxfrm now uses the LC_CTYPE locale category to specify its collation, ignoring any differing LC_COLLATE. It doesn't make sense for a string to be encoded in one locale (say, ISO-8859-6, Arabic) and to collate it based on another (like ISO-8859-7, Greek). Perl assumes that the current LC_CTYPE locale correctly represents the encoding, and collates accordingly.

    Also, embedded NUL characters are now allowed in the input.

    If locale collation is not enabled on the platform (LC_COLLATE), the input is returned unchanged.

  • Double FETCH during stringification of tied scalars returning an overloaded object have been fixed. The FETCH method should only be called once, but prior to this release was actually called twice. [GH #20574]

Known Problems

  • CPAN modules not yet aware of new OPs

    Devel::Caller [RT #144051] has not yet been updated to add awareness of new OPs introduced in this development cycle. [GH #20114]. A patch has been submitted upstream but this has not been incorporated into a new release yet.

    Test::Vars [Test-Vars/GH #47] also requires updating, but since this module's own tests are not failing, it is harder to determine how the new OPs should be accounted for. A potential patch has been submitted upstream, but awaits maintainer assessment.

    Data::Alias [RT #145279] also requires updating to add awareness of new OPs. Investigation is pending and no patch has yet been submitted upstream.

Acknowledgements

Perl 5.37.7 represents approximately 4 weeks of development since Perl 5.37.6 and contains approximately 42,000 lines of changes across 250 files from 20 authors.

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

Bart Van Assche, Craig A. Berry, Eric Herman, Felipe Gasper, Graham Knop, James E Keenan, Karl Williamson, Leon Timmermans, Matthew O. Persico, Max Maischein, Paul Evans, Philippe Bruhat (BooK), Richard Leach, Russ Allbery, Scott Baker, Tomasz Konojacki, Tony Cook, Tsuyoshi Watanabe, Yves Orton, Zakariyya Mughal.

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://github.com/Perl/perl5/issues. There may also be information at http://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.