NAME

perl5374delta - what is new for perl v5.37.4

DESCRIPTION

This document describes differences between the 5.37.3 release and the 5.37.4 release.

If you are upgrading from an earlier release such as 5.37.2, first read perl5373delta, which describes differences between 5.37.2 and 5.37.3.

Incompatible Changes

readline() no longer clears the stream error flag

readline(), also spelled <>, would clear the handle's error flag after an error occurred on the stream.

The error flag is now only cleared when an error occurs when reading from the child process for glob() in miniperl. This allows it to correctly report errors from the child process on close().

Since the error flag is no longer cleared calling close() on the stream may fail and if the stream was not explicitly closed, the implicit close of the stream may produce a warning.

[GH #20060]

INIT blocks no longer run after an exit() in BEGIN

INIT blocks will no longer run after an exit() performed inside of a BEGIN. This means that the combination of the -v option and the -c option no longer executes a compile check as well as showing the perl version. The -v option executes an exit(0) after printing the version information inside of a BEGIN block, and the -c check is implemented by using INIT hooks, resulting in the -v option taking precedence.

[GH #1537] [GH #20181]

Syntax errors will no longer produce "phantom error messages".

Generally perl will continue parsing the source code even after encountering a compile error. In many cases this is helpful, for instance with misspelled variable names it is helpful to show as many examples of the error as possible. But in the case of syntax errors continuing often produces bizarre error messages, and may even cause segmentation faults during the compile process. In this release the compiler will halt at the first syntax error encountered. This means that any code expecting to see the specific error messages we used to produce will be broken. The error that is emitted will be one of the diagnostics that used to be produced, but in some cases some messages that used to be produced will no longer be displayed.

See "Changes to Existing Diagnostics" for more details.

Performance Enhancements

  • Additional optree optimizations for common OP patterns. For example, multiple simple OPs replaced by a single streamlined OP, so as to be more efficient at runtime. [GH #19943], [GH #20063], [GH #20077].

Modules and Pragmata

Updated Modules and Pragmata

  • B::Deparse has been upgraded from version 1.68 to 1.69.

  • Carp has been upgraded from version 1.53 to 1.54.

  • Class::Struct has been upgraded from version 0.66 to 0.67.

  • Config::Perl::V has been upgraded from version 0.33 to 0.34.

  • Errno has been upgraded from version 1.36 to 1.37.

  • ExtUtils::ParseXS has been upgraded from version 3.45 to 3.46.

  • ExtUtils::Typemaps has been upgraded from version 3.45 to 3.46.

  • feature has been upgraded from version 1.75 to 1.76.

  • File::Basename has been upgraded from version 2.85 to 2.86.

  • File::Copy has been upgraded from version 2.39 to 2.40.

  • File::stat has been upgraded from version 1.12 to 1.13.

  • FileHandle has been upgraded from version 2.04 to 2.05.

  • Hash::Util has been upgraded from version 0.29 to 0.30.

  • I18N::Langinfo has been upgraded from version 0.21 to 0.22.

    This module uses the POSIX nl_langinfo(3) function if available, and emulates it otherwise, such as on Windows. This new version improves the handling of the CODESET item. Now it works completely correctly on Windows platforms (barring any bugs in Windows functions), and reliably handles UTF-8, C, and POSIX on other emulated platforms

  • IO has been upgraded from version 1.50 to 1.51.

  • Locale::Maketext has been upgraded from version 1.31 to 1.32.

  • Module::CoreList has been upgraded from version 5.20220820 to 5.20220920.

  • Opcode has been upgraded from version 1.60 to 1.61.

  • POSIX has been upgraded from version 2.04 to 2.06.

  • Safe has been upgraded from version 2.43 to 2.44.

  • Sys::Hostname has been upgraded from version 1.24 to 1.25.

  • Time::HiRes has been upgraded from version 1.9770 to 1.9771.

  • User::grent has been upgraded from version 1.03 to 1.04.

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

  • XS::APItest has been upgraded from version 1.25 to 1.26.

  • XSLoader has been upgraded from version 0.31 to 0.32.

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, open an issue at https://github.com/Perl/perl5/issues.

Additionally, the following selected changes have been made:

  • Entries have been added to perlguts for the new newAV_alloc_x, newAV_alloc_xz and *_simple functions.

  • References to the now-defunct PrePAN service have been removed from perlcommunity and perlmodstyle.

  • A section on symbol naming has been added to perlhacktips.

  • perlexperiment has been edited to properly reference the warning categories for the defer block modifier and extra paired delimiters for quote-like operators.

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

New Warnings

Changes to Existing Diagnostics

  • The compiler will now stop parsing on the first syntax error it encounters. Historically the compiler would attempt to "skip past" the error and continue parsing so that it could list multiple errors. For things like undeclared variables under strict this makes sense. For syntax errors however it has been found that continuing tends to result in a storm of unrelated or bizarre errors that mostly just obscure the true error. In extreme cases it can even lead to segfaults and other incorrect behavior.

    Therefore we have reformed the continuation logic so that the parse will stop after the first seen syntax error. Semantic errors like undeclared variables will not stop the parse, so you may still see multiple errors when compiling code. However if there is a syntax error it will be the last error message reported by perl and all of the errors that you see will be something that actually needs to be fixed.

  • Error messages that output class or package names have been modified to output double quoted strings with various characters escaped so as to make the exact value clear to a reader. The exact rules on which characters are escaped may change over time but currently are that printable ASCII codepoints, with the exception of " and \, and unicode word characters whose codepoint is over 255 are output raw, and any other symbols are escaped much as Data::Dumper might escape them, using \n for newline and \" for double quotes, etc. Codepoints in the range 128-255 are always escaped as they can cause trouble on unicode terminals when output raw.

    In older versions of perl the one liner

    $ perl -le'"thing\n"->foo()'

    would output the following error message exactly as shown here, with text spread over multiple lines because the "\n" would be emitted as a raw newline character:

    Can't locate object method "foo" via package "thing
    " (perhaps you forgot to load "thing
    "?) at -e line 1.

    As of this release we would output this instead (as one line):

    Can't locate object method "foo" via package "thing\n"
      (perhaps you forgot to load "thing\n"?) at -e line 1.

    Notice the newline in the package name has been quoted and escaped, and thus the error message is a single line. The text is shown here wrapped to two lines only for readability.

  • When package or class names in errors are very large the middle excess portion will be elided from the message. As of this release error messages will show only up to the first 128 characters and the last 128 characters in a package or class name in error messages. For example

    $ perl -le'("Foo" x 1000)->new()'

    will output the following as one line:

    Can't locate object method "new" via package "FooFooFooFooFooFooFoo
    FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
    FooFooFooFooFooFooFooFooFooFooFooFooFooFo"..."oFooFooFooFooFooFooFoo
    FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
    FooFooFooFooFooFooFooFooFooFooFooFooFoo" (perhaps you forgot to load
    "FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
    FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFo"...
    "oFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
    FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo"?)
    at -e line 1.

    Notice the "prefix"..."suffix" form of the package name in this case. In previous versions of perl the complete string would have been shown making the error message over 6k long and there was no upper limit on the length of the error message at all. If you accidentally used a 1MB string as a class name then the error message would be over 2MB long. In this perl the upper limit should be around 2k when eliding and escaping are taken into account.

Testing

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

Internal Changes

  • A new API function "Perl_localeconv" in perlapi is added. This is the same as POSIX::localeconv (returning a hash of the localeconv() fields), but directly callable from XS code.

  • A new API function "my_strftime8" in perlapi is added. This is the same as plain "my_strftime" in perlapi, but with an extra parameter that allows the caller to simply and reliably know if the returned string is UTF-8.

  • A new API function, "Perl_langinfo8" in perlapi is added. This is the same as plain "Perl_langinfo" in perlapi, but with an extra parameter that allows the caller to simply and reliably know if the returned string is UTF-8.

  • We have introduced a limit on the number of nested eval EXPR/BEGIN blocks and require/BEGIN (and thus use statements as well) to prevent C stack overflows. This variable can also be used to forbid BEGIN blocks from executing during eval EXPR compilation. The limit defaults to 1000 but can be overridden by setting the ${^MAX_NESTED_EVAL_BEGIN_BLOCKS} variable. The default itself can be changed at compile time with

    -Accflags='-DPERL_MAX_NESTED_EVAL_BEGIN_BLOCKS_DEFAULT=12345'

    Note that this value relates to the size of your C stack and if you choose an inappropriately large value Perl may segfault, be conservative about what you choose.

Known Problems

Acknowledgements

Perl 5.37.4 represents approximately 4 weeks of development since Perl 5.37.3 and contains approximately 20,000 lines of changes across 270 files from 21 authors.

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

Bram, Dagfinn Ilmari Mannsåker, danielnachun, E. Choroba, Ed J, Elvin Aslanov, H.Merijn Brand, James E Keenan, Karen Etheridge, Karl Williamson, Kenneth Ölwing, Leon Timmermans, Neil Bowers, Nicolas R, Paul Evans, Richard Leach, Sisyphus, Todd Rinaldo, Tomasz Konojacki, 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.

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.