CINXE.COM

perldelta - what is new for perl v5.40.0 - Perldoc Browser

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>perldelta - what is new for perl v5.40.0 - Perldoc Browser</title> <link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser"> <link rel="canonical" href="https://perldoc.perl.org/perldelta"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" /> <style> body { background: #f4f4f5; color: #020202; } .navbar-dark { background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%); background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%); background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0); background-repeat: repeat-x; } .navbar-dark .navbar-nav .nav-link, .navbar-dark .navbar-nav .nav-link:focus { color: #fff } .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 } #wrapperlicious { margin: 0 auto; font: 0.9em 'Helvetica Neue', Helvetica, sans-serif; font-weight: normal; line-height: 1.5em; margin: 0; padding: 0; } #wrapperlicious h1 { font-size: 1.5em } #wrapperlicious h2 { font-size: 1.3em } #wrapperlicious h3 { font-size: 1.1em } #wrapperlicious h4 { font-size: 0.9em } #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3, #wrapperlicious h4, #wrapperlicious dt { color: #020202; margin-top: 1em; margin-bottom: 1em; position: relative; font-weight: bold; } #wrapperlicious a { color: inherit; text-decoration: underline } #wrapperlicious #toc { text-decoration: none } #wrapperlicious a:hover { color: #2a2a2a } #wrapperlicious a img { border: 0 } #wrapperlicious :not(pre) > code { color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px; font: 0.9em Consolas, Menlo, Monaco, monospace; padding: 0.3em; } #wrapperlicious dd { margin: 0; margin-left: 2em; } #wrapperlicious dt { color: #2a2a2a; font-weight: bold; margin-left: 0.9em; } #wrapperlicious p { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious li > p { margin-bottom: 0; margin-top: 0; } #wrapperlicious pre { border: 1px solid #c1c1c1; border-radius: 3px; font: 100% Consolas, Menlo, Monaco, monospace; margin-bottom: 1em; margin-top: 1em; } #wrapperlicious pre > code { display: block; background-color: #f6f6f6; font: 0.9em Consolas, Menlo, Monaco, monospace; line-height: 1.5em; text-align: left; white-space: pre; padding: 1em; } #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious ul { list-style-type: square; } #wrapperlicious ul ul { margin-bottom: 0px; margin-top: 0px; } #footer { font-size: 0.8em; padding-top: 0.5em; text-align: center; } #more { display: inline; font-size: 0.8em; } #perldocdiv { background-color: #fff; border: 1px solid #c1c1c1; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; margin-left: auto; margin-right: auto; padding: 3em; padding-top: 1em; max-width: 960px; } #moduleversion { float: right } #wrapperlicious .leading-notice { font-style: italic; padding-left: 1em; margin-top: 1em; margin-bottom: 1em; } #wrapperlicious .permalink { display: none; left: -0.75em; position: absolute; padding-right: 0.25em; text-decoration: none; } #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink, #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink, #wrapperlicious dt:hover .permalink { display: block; } </style> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-KVNWBNT5FB'); gtag('config', 'UA-50555-3'); </script> </head> <body> <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="/">Perldoc Browser</a> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav mr-auto"> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.40.0</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-stable"> <a class="dropdown-item" href="/perldelta">Latest</a> <div class="dropdown-divider"></div> <a class="dropdown-item active" href="/5.40.0/perldelta">5.40.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.2/perldelta">5.38.2</a> <a class="dropdown-item" href="/5.38.1/perldelta">5.38.1</a> <a class="dropdown-item" href="/5.38.0/perldelta">5.38.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.36.3/perldelta">5.36.3</a> <a class="dropdown-item" href="/5.36.2/perldelta">5.36.2</a> <a class="dropdown-item" href="/5.36.1/perldelta">5.36.1</a> <a class="dropdown-item" href="/5.36.0/perldelta">5.36.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.34.3/perldelta">5.34.3</a> <a class="dropdown-item" href="/5.34.2/perldelta">5.34.2</a> <a class="dropdown-item" href="/5.34.1/perldelta">5.34.1</a> <a class="dropdown-item" href="/5.34.0/perldelta">5.34.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.32.1/perldelta">5.32.1</a> <a class="dropdown-item" href="/5.32.0/perldelta">5.32.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.30.3/perldelta">5.30.3</a> <a class="dropdown-item" href="/5.30.2/perldelta">5.30.2</a> <a class="dropdown-item" href="/5.30.1/perldelta">5.30.1</a> <a class="dropdown-item" href="/5.30.0/perldelta">5.30.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.28.3/perldelta">5.28.3</a> <a class="dropdown-item" href="/5.28.2/perldelta">5.28.2</a> <a class="dropdown-item" href="/5.28.1/perldelta">5.28.1</a> <a class="dropdown-item" href="/5.28.0/perldelta">5.28.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.26.3/perldelta">5.26.3</a> <a class="dropdown-item" href="/5.26.2/perldelta">5.26.2</a> <a class="dropdown-item" href="/5.26.1/perldelta">5.26.1</a> <a class="dropdown-item" href="/5.26.0/perldelta">5.26.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.24.4/perldelta">5.24.4</a> <a class="dropdown-item" href="/5.24.3/perldelta">5.24.3</a> <a class="dropdown-item" href="/5.24.2/perldelta">5.24.2</a> <a class="dropdown-item" href="/5.24.1/perldelta">5.24.1</a> <a class="dropdown-item" href="/5.24.0/perldelta">5.24.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.22.4/perldelta">5.22.4</a> <a class="dropdown-item" href="/5.22.3/perldelta">5.22.3</a> <a class="dropdown-item" href="/5.22.2/perldelta">5.22.2</a> <a class="dropdown-item" href="/5.22.1/perldelta">5.22.1</a> <a class="dropdown-item" href="/5.22.0/perldelta">5.22.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.20.3/perldelta">5.20.3</a> <a class="dropdown-item" href="/5.20.2/perldelta">5.20.2</a> <a class="dropdown-item" href="/5.20.1/perldelta">5.20.1</a> <a class="dropdown-item" href="/5.20.0/perldelta">5.20.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.18.4/perldelta">5.18.4</a> <a class="dropdown-item" href="/5.18.3/perldelta">5.18.3</a> <a class="dropdown-item" href="/5.18.2/perldelta">5.18.2</a> <a class="dropdown-item" href="/5.18.1/perldelta">5.18.1</a> <a class="dropdown-item" href="/5.18.0/perldelta">5.18.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.16.3/perldelta">5.16.3</a> <a class="dropdown-item" href="/5.16.2/perldelta">5.16.2</a> <a class="dropdown-item" href="/5.16.1/perldelta">5.16.1</a> <a class="dropdown-item" href="/5.16.0/perldelta">5.16.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.14.4/perldelta">5.14.4</a> <a class="dropdown-item" href="/5.14.3/perldelta">5.14.3</a> <a class="dropdown-item" href="/5.14.2/perldelta">5.14.2</a> <a class="dropdown-item" href="/5.14.1/perldelta">5.14.1</a> <a class="dropdown-item" href="/5.14.0/perldelta">5.14.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.5/perldelta">5.12.5</a> <a class="dropdown-item" href="/5.12.4/perldelta">5.12.4</a> <a class="dropdown-item" href="/5.12.3/perldelta">5.12.3</a> <a class="dropdown-item" href="/5.12.2/perldelta">5.12.2</a> <a class="dropdown-item" href="/5.12.1/perldelta">5.12.1</a> <a class="dropdown-item" href="/5.12.0/perldelta">5.12.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.10.1/perldelta">5.10.1</a> <a class="dropdown-item" href="/5.10.0/perldelta">5.10.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.9/perldelta">5.8.9</a> <a class="dropdown-item" href="/5.8.8/perldelta">5.8.8</a> <a class="dropdown-item" href="/5.8.7/perldelta">5.8.7</a> <a class="dropdown-item" href="/5.8.6/perldelta">5.8.6</a> <a class="dropdown-item" href="/5.8.5/perldelta">5.8.5</a> <a class="dropdown-item" href="/5.8.4/perldelta">5.8.4</a> <a class="dropdown-item" href="/5.8.3/perldelta">5.8.3</a> <a class="dropdown-item" href="/5.8.2/perldelta">5.8.2</a> <a class="dropdown-item" href="/5.8.1/perldelta">5.8.1</a> <a class="dropdown-item" href="/5.8.0/perldelta">5.8.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.2/perldelta">5.6.2</a> <a class="dropdown-item" href="/5.6.1/perldelta">5.6.1</a> <a class="dropdown-item" href="/5.6.0/perldelta">5.6.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_04/perldelta">5.005_04</a> <a class="dropdown-item" href="/5.005_03/perldelta">5.005_03</a> <a class="dropdown-item" href="/5.005_02/perldelta">5.005_02</a> <a class="dropdown-item" href="/5.005_01/perldelta">5.005_01</a> <a class="dropdown-item" href="/5.005/perldelta">5.005</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-dev"> <a class="dropdown-item" href="/blead/perldelta">blead</a> <a class="dropdown-item" href="/5.41.6/perldelta">5.41.6</a> <a class="dropdown-item" href="/5.41.5/perldelta">5.41.5</a> <a class="dropdown-item" href="/5.41.4/perldelta">5.41.4</a> <a class="dropdown-item" href="/5.41.3/perldelta">5.41.3</a> <a class="dropdown-item" href="/5.41.2/perldelta">5.41.2</a> <a class="dropdown-item" href="/5.41.1/perldelta">5.41.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.0-RC2/perldelta">5.40.0-RC2</a> <a class="dropdown-item" href="/5.40.0-RC1/perldelta">5.40.0-RC1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.39.10/perldelta">5.39.10</a> <a class="dropdown-item" href="/5.39.9/perldelta">5.39.9</a> <a class="dropdown-item" href="/5.39.8/perldelta">5.39.8</a> <a class="dropdown-item" href="/5.39.7/perldelta">5.39.7</a> <a class="dropdown-item" href="/5.39.6/perldelta">5.39.6</a> <a class="dropdown-item" href="/5.39.5/perldelta">5.39.5</a> <a class="dropdown-item" href="/5.39.4/perldelta">5.39.4</a> <a class="dropdown-item" href="/5.39.3/perldelta">5.39.3</a> <a class="dropdown-item" href="/5.39.2/perldelta">5.39.2</a> <a class="dropdown-item" href="/5.39.1/perldelta">5.39.1</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-nav"> <a class="dropdown-item" href="/5.40.0/perl">Perl</a> <a class="dropdown-item" href="/5.40.0/perlintro">Intro</a> <a class="dropdown-item" href="/5.40.0/perl#Tutorials">Tutorials</a> <a class="dropdown-item" href="/5.40.0/perlfaq">FAQs</a> <a class="dropdown-item" href="/5.40.0/perl#Reference-Manual">Reference</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.0/perlop">Operators</a> <a class="dropdown-item" href="/5.40.0/functions">Functions</a> <a class="dropdown-item" href="/5.40.0/variables">Variables</a> <a class="dropdown-item" href="/5.40.0/modules">Modules</a> <a class="dropdown-item" href="/5.40.0/perlutil">Utilities</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.0/perldelta">Release Notes</a> <a class="dropdown-item" href="/5.40.0/perlcommunity">Community</a> <a class="dropdown-item" href="/5.40.0/perlhist">History</a> </div> </li> </ul> <ul class="navbar-nav"> <script> function set_expand (expand) { var perldocdiv = document.getElementById('perldocdiv'); var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width'); var expanded = (width == '' || width == 'none') ? true : false; if (expand === null) { expand = !expanded; } if ((expand && !expanded) || (!expand && expanded)) { perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px'); var button_classlist = document.getElementById('content-expand-button').classList; if (expand) { button_classlist.add('btn-light'); button_classlist.remove('btn-outline-light'); } else { button_classlist.add('btn-outline-light'); button_classlist.remove('btn-light'); } } return expand; } function toggle_expand () { var expand = set_expand(null); document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC'; } function read_expand () { return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { if (read_expand()) { set_expand(true); } }); } else if (read_expand()) { set_expand(true); } </script> <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-4" onclick="toggle_expand()">Expand</button> </ul> <form class="form-inline" method="get" action="/5.40.0/search"> <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search" value=""> </form> </div> </nav> <div id="wrapperlicious" class="container-fluid"> <div id="perldocdiv"> <div id="links"> <a href="/5.40.0/perldelta">perldelta</a> <div id="more"> (<a href="/5.40.0/perldelta.txt">source</a>, <a href="https://metacpan.org/pod/perldelta">CPAN</a>) </div> </div> <div class="leading-notice"> You are viewing the version of this documentation from Perl 5.40.0. <a href="/perldelta">View the latest version</a> </div> <h1><a id="toc">CONTENTS</a></h1> <ul> <li> <a class="text-decoration-none" href="#NAME">NAME</a> </li> <li> <a class="text-decoration-none" href="#DESCRIPTION">DESCRIPTION</a> </li> <li> <a class="text-decoration-none" href="#Core-Enhancements">Core Enhancements</a> <ul> <li> <a class="text-decoration-none" href="#New-__CLASS__-Keyword">New __CLASS__ Keyword</a> </li> <li> <a class="text-decoration-none" href="#:reader-attribute-for-field-variables">:reader attribute for field variables</a> </li> <li> <a class="text-decoration-none" href="#Permit-a-space-in-M-command-line-option">Permit a space in -M command-line option</a> </li> <li> <a class="text-decoration-none" href="#Restrictions-to-use-VERSION-declarations">Restrictions to use VERSION declarations</a> </li> <li> <a class="text-decoration-none" href="#New-builtin::inf-and-builtin::nan-functions-(experimental)">New builtin::inf and builtin::nan functions (experimental)</a> </li> <li> <a class="text-decoration-none" href="#New-%5E%5E-logical-xor-operator">New ^^ logical xor operator</a> </li> <li> <a class="text-decoration-none" href="#try/catch-feature-is-no-longer-experimental">try/catch feature is no longer experimental</a> </li> <li> <a class="text-decoration-none" href="#for-iterating-over-multiple-values-at-a-time-is-no-longer-experimental">for iterating over multiple values at a time is no longer experimental</a> </li> <li> <a class="text-decoration-none" href="#builtin-module-is-no-longer-experimental">builtin module is no longer experimental</a> </li> <li> <a class="text-decoration-none" href="#The-:5.40-feature-bundle-adds-try">The :5.40 feature bundle adds try</a> </li> <li> <a class="text-decoration-none" href="#use-v5.40;-imports-builtin-functions">use v5.40; imports builtin functions</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Security">Security</a> <ul> <li> <a class="text-decoration-none" href="#CVE-2023-47038-Write-past-buffer-end-via-illegal-user-defined-Unicode-property">CVE-2023-47038 - Write past buffer end via illegal user-defined Unicode property</a> </li> <li> <a class="text-decoration-none" href="#CVE-2023-47039-Perl-for-Windows-binary-hijacking-vulnerability">CVE-2023-47039 - Perl for Windows binary hijacking vulnerability</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Incompatible-Changes">Incompatible Changes</a> <ul> <li> <a class="text-decoration-none" href="#reset-EXPR-now-calls-set-magic-on-scalars">reset EXPR now calls set-magic on scalars</a> </li> <li> <a class="text-decoration-none" href="#Calling-the-import-method-of-an-unknown-package-produces-a-warning">Calling the import method of an unknown package produces a warning</a> </li> <li> <a class="text-decoration-none" href="#return-no-longer-allows-an-indirect-object">return no longer allows an indirect object</a> </li> <li> <a class="text-decoration-none" href="#Class-barewords-no-longer-resolved-as-file-handles-in-method-calls-under-no-feature-%22bareword_filehandles%22">Class barewords no longer resolved as file handles in method calls under no feature &quot;bareword_filehandles&quot;</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Deprecations">Deprecations</a> </li> <li> <a class="text-decoration-none" href="#Performance-Enhancements">Performance Enhancements</a> </li> <li> <a class="text-decoration-none" href="#Modules-and-Pragmata">Modules and Pragmata</a> <ul> <li> <a class="text-decoration-none" href="#New-Modules-and-Pragmata">New Modules and Pragmata</a> </li> <li> <a class="text-decoration-none" href="#Updated-Modules-and-Pragmata">Updated Modules and Pragmata</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Documentation">Documentation</a> <ul> <li> <a class="text-decoration-none" href="#Changes-to-Existing-Documentation">Changes to Existing Documentation</a> <ul> <li> <a class="text-decoration-none" href="#perlapi">perlapi</a> </li> <li> <a class="text-decoration-none" href="#perlclass">perlclass</a> </li> <li> <a class="text-decoration-none" href="#perlfunc">perlfunc</a> </li> <li> <a class="text-decoration-none" href="#perlguts">perlguts</a> </li> <li> <a class="text-decoration-none" href="#perlclib">perlclib</a> </li> <li> <a class="text-decoration-none" href="#perlhacktips">perlhacktips</a> </li> <li> <a class="text-decoration-none" href="#perllol">perllol</a> </li> <li> <a class="text-decoration-none" href="#perlre">perlre</a> </li> <li> <a class="text-decoration-none" href="#perlref">perlref</a> </li> <li> <a class="text-decoration-none" href="#perlop">perlop</a> </li> <li> <a class="text-decoration-none" href="#perlport">perlport</a> </li> <li> <a class="text-decoration-none" href="#perlvar">perlvar</a> </li> </ul> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Diagnostics">Diagnostics</a> <ul> <li> <a class="text-decoration-none" href="#New-Diagnostics">New Diagnostics</a> <ul> <li> <a class="text-decoration-none" href="#New-Errors">New Errors</a> </li> <li> <a class="text-decoration-none" href="#New-Warnings">New Warnings</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Changes-to-Existing-Diagnostics">Changes to Existing Diagnostics</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Configuration-and-Compilation">Configuration and Compilation</a> </li> <li> <a class="text-decoration-none" href="#Testing">Testing</a> </li> <li> <a class="text-decoration-none" href="#Platform-Support">Platform Support</a> <ul> <li> <a class="text-decoration-none" href="#New-Platforms">New Platforms</a> </li> <li> <a class="text-decoration-none" href="#Platform-Specific-Notes">Platform-Specific Notes</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Internal-Changes">Internal Changes</a> </li> <li> <a class="text-decoration-none" href="#Selected-Bug-Fixes">Selected Bug Fixes</a> </li> <li> <a class="text-decoration-none" href="#Known-Problems">Known Problems</a> </li> <li> <a class="text-decoration-none" href="#Errata-From-Previous-Releases">Errata From Previous Releases</a> </li> <li> <a class="text-decoration-none" href="#Acknowledgements">Acknowledgements</a> </li> <li> <a class="text-decoration-none" href="#Reporting-Bugs">Reporting Bugs</a> </li> <li> <a class="text-decoration-none" href="#Give-Thanks">Give Thanks</a> </li> <li> <a class="text-decoration-none" href="#SEE-ALSO">SEE ALSO</a> </li> </ul> <h1 id="NAME"><a class="permalink" href="#NAME">#</a>NAME</h1> <p>perldelta - what is new for perl v5.40.0</p> <h1 id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">#</a>DESCRIPTION</h1> <p>This document describes differences between the 5.38.0 release and the 5.40.0 release.</p> <h1 id="Core-Enhancements"><a class="permalink" href="#Core-Enhancements">#</a><a id="Core"></a>Core Enhancements</h1> <h2 id="New-__CLASS__-Keyword"><a class="permalink" href="#New-__CLASS__-Keyword">#</a><a id="New"></a>New <code>__CLASS__</code> Keyword</h2> <p>When using the new <code>class</code> feature, code inside a method, <code>ADJUST</code> block or field initializer expression is now permitted to use the new <code>__CLASS__</code> keyword. This yields a class name, similar to <code>__PACKAGE__</code>, but whereas that gives the compile-time package that the code appears in, the <code>__CLASS__</code> keyword is aware of the actual run-time class that the object instance is a member of. This makes it useful for method dispatch on that class, especially during constructors, where access to <code>$self</code> is not permitted.</p> <p>For more information, see <a href="/5.40.0/perlfunc#__CLASS__">&quot;__CLASS__&quot; in perlfunc</a>.</p> <h2 id=":reader-attribute-for-field-variables"><a class="permalink" href="#:reader-attribute-for-field-variables">#</a><a id="reader-attribute-for-field-variables"></a><code>:reader</code> attribute for field variables</h2> <p>When using the <code>class</code> feature, field variables can now take a <code>:reader</code> attribute. This requests that an accessor method be automatically created that simply returns the value of the field variable from the given instance.</p> <pre><code>field $name :reader;</code></pre> <p>Is equivalent to</p> <pre><code>field $name; method name () { return $name; }</code></pre> <p>An alternative name can also be provided:</p> <pre><code>field $name :reader(get_name);</code></pre> <p>For more detail, see <a href="/5.40.0/perlclass#%3Areader">&quot;:reader&quot; in perlclass</a>.</p> <h2 id="Permit-a-space-in-M-command-line-option"><a class="permalink" href="#Permit-a-space-in-M-command-line-option">#</a><a id="Permit"></a><a id="Permit-a-space-in--M-command-line-option"></a>Permit a space in <code>-M</code> command-line option</h2> <p>When processing command-line options, perl now allows a space between the <code>-M</code> switch and the name of the module after it.</p> <pre><code class="plaintext">$ perl -M Data::Dumper=Dumper -E &#39;say Dumper [1,2,3]&#39;</code></pre> <p>This matches the existing behaviour of the <code>-I</code> option.</p> <h2 id="Restrictions-to-use-VERSION-declarations"><a class="permalink" href="#Restrictions-to-use-VERSION-declarations">#</a><a id="Restrictions"></a>Restrictions to <code>use VERSION</code> declarations</h2> <p>In Perl 5.36, a deprecation warning was added when downgrading a <code>use VERSION</code> declaration from one above version 5.11, to below. This has now been made a fatal error.</p> <p>Additionally, it is now a fatal error to issue a subsequent <code>use VERSION</code> declaration when another is in scope, when either version is 5.39 or above. This is to avoid complications surrounding imported lexical functions from <a href="/5.40.0/builtin">builtin</a>. A deprecation warning has also been added for any other subsequent <code>use VERSION</code> declaration below version 5.39, to warn that it will no longer be permitted in Perl version 5.44.</p> <h2 id="New-builtin::inf-and-builtin::nan-functions-(experimental)"><a class="permalink" href="#New-builtin::inf-and-builtin::nan-functions-(experimental)">#</a><a id="New1"></a><a id="New-builtin::inf-and-builtin::nan-functions-experimental"></a>New <code>builtin::inf</code> and <code>builtin::nan</code> functions (experimental)</h2> <p>Two new functions, <code>inf</code> and <code>nan</code>, have been added to the <code>builtin</code> namespace. These act like constants that yield the floating-point infinity and Not-a-Number value respectively.</p> <h2 id="New-^^-logical-xor-operator"><a class="permalink" href="#New-%5E%5E-logical-xor-operator">#</a><a id="New2"></a><a id="New-logical-xor-operator"></a>New <code>^^</code> logical xor operator</h2> <p>Perl has always had three low-precedence logical operators <code>and</code>, <code>or</code> and <code>xor</code>, as well as three high-precedence bitwise versions <code>&amp;</code>, <code>^</code> and <code>|</code>. Until this release, while the medium-precedence logical operators of <code>&amp;&amp;</code> and <code>||</code> were also present, there was no exclusive-or equivalent. This release of Perl adds the final <code>^^</code> operator, completing the set.</p> <pre><code>$x ^^ $y and say &quot;One of x or y is true, but not both&quot;;</code></pre> <h2 id="try/catch-feature-is-no-longer-experimental"><a class="permalink" href="#try/catch-feature-is-no-longer-experimental">#</a><a id="try"></a><a id="try-catch-feature-is-no-longer-experimental"></a><code>try</code>/<code>catch</code> feature is no longer experimental</h2> <p>Prior to this release, the <code>try</code>/<code>catch</code> feature for handling errors was considered experimental. Introduced in Perl version 5.34.0, this is now considered a stable language feature and its use no longer prints a warning. It still must be enabled with <a href="/5.40.0/feature#The-%27try%27-feature">the &#39;try&#39; feature</a>.</p> <p>See <a href="/5.40.0/perlsyn#Try-Catch-Exception-Handling">&quot;Try Catch Exception Handling&quot; in perlsyn</a>.</p> <h2 id="for-iterating-over-multiple-values-at-a-time-is-no-longer-experimental"><a class="permalink" href="#for-iterating-over-multiple-values-at-a-time-is-no-longer-experimental">#</a><a id="for"></a><code>for</code> iterating over multiple values at a time is no longer experimental</h2> <p>Prior to this release, iterating over multiple values at a time with <code>for</code> was considered experimental. Introduced in Perl version 5.36.0, this is now considered a stable language feature and its use no longer prints a warning. See <a href="/5.40.0/perlsyn#Compound-Statements">&quot;Compound Statements&quot; in perlsyn</a>.</p> <h2 id="builtin-module-is-no-longer-experimental"><a class="permalink" href="#builtin-module-is-no-longer-experimental">#</a><a id="builtin"></a><code>builtin</code> module is no longer experimental</h2> <p>Prior to this release, the <a href="/5.40.0/builtin">builtin</a> module and all of its functions were considered experimental. Introduced in Perl version 5.36.0, this module is now considered stable its use no longer prints a warning. However, several of its functions are still considered experimental.</p> <h2 id="The-:5.40-feature-bundle-adds-try"><a class="permalink" href="#The-:5.40-feature-bundle-adds-try">#</a><a id="The"></a>The <code>:5.40</code> feature bundle adds <code>try</code></h2> <p>The latest version feature bundle now contains the recently-stablized feature <code>try</code>. As this feature bundle is used by the <code>-E</code> commandline switch, these are immediately available in <code>-E</code> scripts.</p> <h2 id="use-v5.40;-imports-builtin-functions"><a class="permalink" href="#use-v5.40;-imports-builtin-functions">#</a><a id="use"></a><a id="use-v5.40-imports-builtin-functions"></a><code>use v5.40;</code> imports builtin functions</h2> <p>In addition to importing a feature bundle, <code>use v5.40;</code> (or later versions) imports the corresponding <a href="/5.40.0/builtin#Version-Bundles">builtin version bundle</a>.</p> <h1 id="Security"><a class="permalink" href="#Security">#</a>Security</h1> <h2 id="CVE-2023-47038-Write-past-buffer-end-via-illegal-user-defined-Unicode-property"><a class="permalink" href="#CVE-2023-47038-Write-past-buffer-end-via-illegal-user-defined-Unicode-property">#</a><a id="CVE"></a><a id="CVE-2023-47038---Write-past-buffer-end-via-illegal-user-defined-Unicode-property"></a>CVE-2023-47038 - Write past buffer end via illegal user-defined Unicode property</h2> <p>This vulnerability was reported directly to the Perl security team by Nathan Mills <code>the.true.nathan.mills@gmail.com</code>.</p> <p>A crafted regular expression when compiled by perl 5.30.0 through 5.38.0 can cause a one-byte attacker controlled buffer overflow in a heap allocated buffer.</p> <h2 id="CVE-2023-47039-Perl-for-Windows-binary-hijacking-vulnerability"><a class="permalink" href="#CVE-2023-47039-Perl-for-Windows-binary-hijacking-vulnerability">#</a><a id="CVE1"></a><a id="CVE-2023-47039---Perl-for-Windows-binary-hijacking-vulnerability"></a>CVE-2023-47039 - Perl for Windows binary hijacking vulnerability</h2> <p>This vulnerability was reported to the Intel Product Security Incident Response Team (PSIRT) by GitHub user ycdxsb <a href="https://github.com/ycdxsb/WindowsPrivilegeEscalation">https://github.com/ycdxsb/WindowsPrivilegeEscalation</a>. PSIRT then reported it to the Perl security team.</p> <p>Perl for Windows relies on the system path environment variable to find the shell (<code>cmd.exe</code>). When running an executable which uses Windows Perl interpreter, Perl attempts to find and execute <code>cmd.exe</code> within the operating system. However, due to path search order issues, Perl initially looks for cmd.exe in the current working directory.</p> <p>An attacker with limited privileges can exploit this behavior by placing <code>cmd.exe</code> in locations with weak permissions, such as <code>C:\ProgramData</code>. By doing so, when an administrator attempts to use this executable from these compromised locations, arbitrary code can be executed.</p> <h1 id="Incompatible-Changes"><a class="permalink" href="#Incompatible-Changes">#</a><a id="Incompatible"></a>Incompatible Changes</h1> <h2 id="reset-EXPR-now-calls-set-magic-on-scalars"><a class="permalink" href="#reset-EXPR-now-calls-set-magic-on-scalars">#</a><a id="reset"></a>reset EXPR now calls set-magic on scalars</h2> <p>Previously <code>reset EXPR</code> did not call set magic when clearing scalar variables. This meant that changes did not propagate to the underlying internal state where needed, such as for <code>$^W</code>, and did not result in an exception where the underlying magic would normally throw an exception, such as for <code>$1</code>.</p> <p>This means code that had no effect before may now actually have an effect, including possibly throwing an exception.</p> <p><code>reset EXPR</code> already called set magic when modifying arrays and hashes.</p> <p>This has no effect on plain <code>reset</code> used to reset one-match searches as with <code>m?pattern?</code>.</p> <p>[<a href="https://github.com/Perl/perl5/issues/20763">GH #20763</a>]</p> <h2 id="Calling-the-import-method-of-an-unknown-package-produces-a-warning"><a class="permalink" href="#Calling-the-import-method-of-an-unknown-package-produces-a-warning">#</a><a id="Calling"></a>Calling the import method of an unknown package produces a warning</h2> <p>Historically, it has been possible to call the <code>import</code> or <code>unimport</code> method of any class, including ones which have not been defined, with an argument and not experience an error. For instance, this code will not throw an error in Perl 5.38:</p> <pre><code>Class::That::Does::Not::Exist-&gt;import(&quot;foo&quot;);</code></pre> <p>However, as of Perl 5.39.1 this is deprecated and will issue a warning. Note that calling these methods with no arguments continues to silently succeed and do nothing. For instance,</p> <pre><code>Class::That::Does::Not::Exist-&gt;import();</code></pre> <p>will continue to not throw an error. This is because every class implicitly inherits from the class <a href="/5.40.0/UNIVERSAL">UNIVERSAL</a> which now defines an <code>import</code> method. In older perls there was no such method defined, and instead the method calls for <code>import</code> and <code>unimport</code> were special cased to not throw errors if there was no such method defined.</p> <p>This change has been added because it makes it easier to detect case typos in <code>use</code> statements when running on case-insensitive file systems. For instance, on Windows or other platforms with case-insensitive file systems on older perls the following code</p> <pre><code>use STRICT &#39;refs&#39;;</code></pre> <p>would silently do nothing as the module is actually called <i>strict.pm</i>, not <i>STRICT.pm</i>, so it would be loaded but its import method would never be called. It will also detect cases where a user passes an argument when using a package that does not provide its own import, for instance most &quot;pure&quot; class definitions do not define an import method.</p> <h2 id="return-no-longer-allows-an-indirect-object"><a class="permalink" href="#return-no-longer-allows-an-indirect-object">#</a><a id="return"></a><code>return</code> no longer allows an indirect object</h2> <p>The <code>return</code> operator syntax now rejects indirect objects. In most cases this would compile and even run, but wasn&#39;t documented and could produce confusing results, for example:</p> <pre><code># note that sum hasn&#39;t been defined sub sum_positive { return sum grep $_ &gt; 0, @_; # unexpectedly parsed as: # return *sum, grep $_ &gt; 0, @_; # ... with the bareword acting like an extra (typeglob) argument } say for sum_positive(-1, 2, 3)</code></pre> <p>produced:</p> <pre><code class="plaintext">*main::sum 2 3</code></pre> <p>[<a href="https://github.com/Perl/perl5/issues/21716">GH #21716</a>]</p> <h2 id="Class-barewords-no-longer-resolved-as-file-handles-in-method-calls-under-no-feature-&quot;bareword_filehandles&quot;"><a class="permalink" href="#Class-barewords-no-longer-resolved-as-file-handles-in-method-calls-under-no-feature-%22bareword_filehandles%22">#</a><a id="Class"></a><a id="Class-barewords-no-longer-resolved-as-file-handles-in-method-calls-under-no-feature-bareword_filehandles"></a>Class barewords no longer resolved as file handles in method calls under <code>no feature &quot;bareword_filehandles&quot;</code></h2> <p>Under <code>no feature &quot;bareword_filehandles&quot;</code> bareword file handles continued to be resolved in method calls:</p> <pre><code>open FH, &quot;&lt;&quot;, $somefile or die; no feature &#39;bareword_filehandles&#39;; FH-&gt;binmode;</code></pre> <p>This has been fixed, so the:</p> <pre><code>FH-&gt;binmode;</code></pre> <p>will attempt to resolve <code>FH</code> as a class, typically resulting in a runtime error.</p> <p>The standard file handles such as <code>STDOUT</code> continue to be resolved as a handle:</p> <pre><code>no feature &#39;bareword_filehandles&#39;; STDOUT-&gt;flush; # continues to work</code></pre> <p>Note that once perl resolves a bareword name as a class it will continue to do so:</p> <pre><code>package SomeClass { sub somemethod{} } open SomeClass, &quot;&lt;&quot;, &quot;somefile&quot; or die; # SomeClass resolved as a handle SomeClass-&gt;binmode; { no feature &quot;bareword_filehandles&quot;; SomeClass-&gt;somemethod; } # SomeClass resolved as a class SomeClass-&gt;binmode;</code></pre> <p>[<a href="https://github.com/Perl/perl5/issues/19426">GH #19426</a>]</p> <h1 id="Deprecations"><a class="permalink" href="#Deprecations">#</a>Deprecations</h1> <ul> <li><p>Using <code>goto</code> to jump from an outer scope into an inner scope is deprecated and will be removed completely in Perl 5.42. [<a href="https://github.com/Perl/perl5/issues/21601">GH #21601</a>]</p> </li> </ul> <h1 id="Performance-Enhancements"><a class="permalink" href="#Performance-Enhancements">#</a><a id="Performance"></a>Performance Enhancements</h1> <ul> <li><p>The negation OPs have been modified to support the generic <code>TARGMY</code> optimization. [<a href="https://github.com/Perl/perl5/issues/21442">GH #21442</a>]</p> </li> </ul> <h1 id="Modules-and-Pragmata"><a class="permalink" href="#Modules-and-Pragmata">#</a><a id="Modules"></a>Modules and Pragmata</h1> <h2 id="New-Modules-and-Pragmata"><a class="permalink" href="#New-Modules-and-Pragmata">#</a><a id="New3"></a>New Modules and Pragmata</h2> <ul> <li><p><a href="/5.40.0/Term::Table">Term::Table</a> 0.018 has been added to the Perl core.</p> <p>This module is a dependency of <a href="/5.40.0/Test2::Suite">Test2::Suite</a>.</p> </li> <li><p><a href="/5.40.0/Test2::Suite">Test2::Suite</a> 0.000162 has been added to the Perl core.</p> <p>This distribution contains a comprehensive set of test tools for writing unit tests. It is the successor to <a href="/5.40.0/Test::More">Test::More</a> and similar modules. Its inclusion in the Perl core means that CPAN module tests can be written using this suite of tools without extra dependencies.</p> </li> </ul> <h2 id="Updated-Modules-and-Pragmata"><a class="permalink" href="#Updated-Modules-and-Pragmata">#</a><a id="Updated"></a>Updated Modules and Pragmata</h2> <ul> <li><p><a href="/5.40.0/Archive::Tar">Archive::Tar</a> has been upgraded from version 2.40 to 3.02_001.</p> </li> <li><p><a href="/5.40.0/attributes">attributes</a> has been upgraded from version 0.35 to 0.36.</p> </li> <li><p><a href="/5.40.0/autodie">autodie</a> has been upgraded from version 2.36 to 2.37.</p> </li> <li><p><a href="/5.40.0/B">B</a> has been upgraded from version 1.88 to 1.89.</p> </li> <li><p><a href="/5.40.0/B::Deparse">B::Deparse</a> has been upgraded from version 1.74 to 1.76.</p> </li> <li><p><a href="/5.40.0/Benchmark">Benchmark</a> has been upgraded from version 1.24 to 1.25.</p> </li> <li><p><a href="/5.40.0/bignum">bignum</a> has been upgraded from version 0.66 to 0.67.</p> </li> <li><p><a href="/5.40.0/builtin">builtin</a> has been upgraded from version 0.008 to 0.014.</p> <p><a href="/5.40.0/builtin">builtin</a> now accepts a version bundle as an input argument, requesting it to import all of the functions that are considered a stable part of the module at the given Perl version. For example:</p> <pre><code>use builtin &#39;:5.40&#39;;</code></pre> <p>Added the <code>load_module()</code> builtin function as per <a href="https://github.com/Perl/PPCs/blob/main/ppcs/ppc0006-load-module.md">PPC 0006</a>.</p> </li> <li><p><a href="/5.40.0/bytes">bytes</a> has been upgraded from version 1.08 to 1.09.</p> </li> <li><p><a href="/5.40.0/Compress::Raw::Bzip2">Compress::Raw::Bzip2</a> has been upgraded from version 2.204_001 to 2.212.</p> </li> <li><p><a href="/5.40.0/Compress::Raw::Zlib">Compress::Raw::Zlib</a> has been upgraded from version 2.204_001 to 2.212.</p> </li> <li><p><a href="/5.40.0/CPAN::Meta::Requirements">CPAN::Meta::Requirements</a> has been upgraded from version 2.140 to 2.143.</p> </li> <li><p><a href="/5.40.0/Data::Dumper">Data::Dumper</a> has been upgraded from version 2.188 to 2.189.</p> </li> <li><p><a href="/5.40.0/DB_File">DB_File</a> has been upgraded from version 1.858 to 1.859.</p> </li> <li><p><a href="/5.40.0/Devel::Peek">Devel::Peek</a> has been upgraded from version 1.33 to 1.34.</p> </li> <li><p><a href="/5.40.0/Devel::PPPort">Devel::PPPort</a> has been upgraded from version 3.71 to 3.72.</p> </li> <li><p><a href="/5.40.0/diagnostics">diagnostics</a> has been upgraded from version 1.39 to 1.40.</p> </li> <li><p><a href="/5.40.0/DynaLoader">DynaLoader</a> has been upgraded from version 1.54 to 1.56.</p> </li> <li><p><a href="/5.40.0/Encode">Encode</a> has been upgraded from version 3.19 to 3.21.</p> </li> <li><p><a href="/5.40.0/Errno">Errno</a> has been upgraded from version 1.37 to 1.38.</p> <p>The <code>osvers</code> and <code>archname</code> baked into the module to ensure Errno is loaded by the perl that built it are now more comprehensively escaped. [<a href="https://github.com/Perl/perl5/issues/21135">GH #21135</a>]</p> </li> <li><p><a href="/5.40.0/experimental">experimental</a> has been upgraded from version 0.031 to 0.032.</p> </li> <li><p><a href="/5.40.0/Exporter">Exporter</a> has been upgraded from version 5.77 to 5.78.</p> </li> <li><p><a href="/5.40.0/ExtUtils::CBuilder">ExtUtils::CBuilder</a> has been upgraded from version 0.280238 to 0.280240.</p> </li> <li><p><a href="/5.40.0/ExtUtils::Manifest">ExtUtils::Manifest</a> has been upgraded from version 1.73 to 1.75.</p> </li> <li><p><a href="/5.40.0/ExtUtils::Miniperl">ExtUtils::Miniperl</a> has been upgraded from version 1.13 to 1.14.</p> </li> <li><p><a href="/5.40.0/Fcntl">Fcntl</a> has been upgraded from version 1.15 to 1.18.</p> <p>The old module documentation stub has been greatly expanded and revised.</p> <p>Adds support for the <code>O_TMPFILE</code> flag on Linux.</p> </li> <li><p><a href="/5.40.0/feature">feature</a> has been upgraded from version 1.82 to 1.89.</p> <p>It now documents the <code>:all</code> feature bundle, and suggests a reason why you may not wish to use it.</p> </li> <li><p><a href="/5.40.0/fields">fields</a> has been upgraded from version 2.24 to 2.25.</p> </li> <li><p><a href="/5.40.0/File::Compare">File::Compare</a> has been upgraded from version 1.1007 to 1.1008.</p> </li> <li><p><a href="/5.40.0/File::Find">File::Find</a> has been upgraded from version 1.43 to 1.44.</p> </li> <li><p><a href="/5.40.0/File::Glob">File::Glob</a> has been upgraded from version 1.40 to 1.42.</p> </li> <li><p><a href="/5.40.0/File::Spec">File::Spec</a> has been upgraded from version 3.89 to 3.90.</p> </li> <li><p><a href="/5.40.0/File::stat">File::stat</a> has been upgraded from version 1.13 to 1.14.</p> </li> <li><p><a href="/5.40.0/FindBin">FindBin</a> has been upgraded from version 1.53 to 1.54.</p> </li> <li><p><a href="/5.40.0/Getopt::Long">Getopt::Long</a> has been upgraded from version 2.54 to 2.57.</p> </li> <li><p><a href="/5.40.0/Getopt::Std">Getopt::Std</a> has been upgraded from version 1.13 to 1.14.</p> <p>Documentation and test improvements only; no change in functionality.</p> </li> <li><p><a href="/5.40.0/Hash::Util">Hash::Util</a> has been upgraded from version 0.30 to 0.32.</p> </li> <li><p><a href="/5.40.0/Hash::Util::FieldHash">Hash::Util::FieldHash</a> has been upgraded from version 1.26 to 1.27.</p> </li> <li><p><a href="/5.40.0/HTTP::Tiny">HTTP::Tiny</a> has been upgraded from version 0.086 to 0.088.</p> </li> <li><p><a href="/5.40.0/I18N::Langinfo">I18N::Langinfo</a> has been upgraded from version 0.22 to 0.24.</p> <p>It now handles the additional locale categories that Linux defines beyond those in the POSIX Standard.</p> <p>This fixes what is returned for the <code>ALT_DIGITS</code> item, which has never before worked properly in Perl.</p> </li> <li><p><a href="/5.40.0/IO">IO</a> has been upgraded from version 1.52 to 1.55.</p> <p>Fixed <code>IO::Handle/blocking</code> on Windows, which has been non-functional since IO 1.32. [<a href="https://github.com/Perl/perl5/issues/17455">GH #17455</a>]</p> </li> <li><p>IO-Compress has been upgraded from version 2.204 to 2.212.</p> </li> <li><p><a href="/5.40.0/IO::Socket::IP">IO::Socket::IP</a> has been upgraded from version 0.41_01 to 0.42.</p> </li> <li><p><a href="/5.40.0/IO::Zlib">IO::Zlib</a> has been upgraded from version 1.14 to 1.15.</p> </li> <li><p><a href="/5.40.0/locale">locale</a> has been upgraded from version 1.10 to 1.12.</p> </li> <li><p><a href="/5.40.0/Math::BigInt">Math::BigInt</a> has been upgraded from version 1.999837 to 2.003002.</p> </li> <li><p><a href="/5.40.0/Math::BigInt::FastCalc">Math::BigInt::FastCalc</a> has been upgraded from version 0.5013 to 0.5018.</p> </li> <li><p><a href="/5.40.0/Module::CoreList">Module::CoreList</a> has been upgraded from version 5.20230520 to 5.20240609.</p> </li> <li><p><a href="/5.40.0/Module::Metadata">Module::Metadata</a> has been upgraded from version 1.000037 to 1.000038.</p> </li> <li><p><a href="/5.40.0/mro">mro</a> has been upgraded from version 1.28 to 1.29.</p> </li> <li><p><a href="/5.40.0/NDBM_File">NDBM_File</a> has been upgraded from version 1.16 to 1.17.</p> </li> <li><p><a href="/5.40.0/Opcode">Opcode</a> has been upgraded from version 1.64 to 1.65.</p> </li> <li><p><a href="/5.40.0/perl5db.pl">perl5db.pl</a> has been upgraded from version 1.77 to 1.78.</p> <p>Made parsing of the <code>l</code> command arguments saner. [<a href="https://github.com/Perl/perl5/issues/21350">GH #21350</a>]</p> </li> <li><p><a href="/5.40.0/perlfaq">perlfaq</a> has been upgraded from version 5.20210520 to 5.20240218.</p> </li> <li><p><a href="/5.40.0/PerlIO::encoding">PerlIO::encoding</a> has been upgraded from version 0.30 to 0.31.</p> </li> <li><p><a href="/5.40.0/PerlIO::scalar">PerlIO::scalar</a> has been upgraded from version 0.31 to 0.32.</p> </li> <li><p><a href="/5.40.0/PerlIO::via">PerlIO::via</a> has been upgraded from version 0.18 to 0.19.</p> </li> <li><p><a href="/5.40.0/Pod::Checker">Pod::Checker</a> has been upgraded from version 1.75 to 1.77.</p> </li> <li><p><a href="/5.40.0/Pod::Html">Pod::Html</a> has been upgraded from version 1.34 to 1.35.</p> </li> <li><p><a href="/5.40.0/Pod::Simple">Pod::Simple</a> has been upgraded from version 3.43 to 3.45.</p> </li> <li><p><a href="/5.40.0/podlators">podlators</a> has been upgraded from version 5.01 to 5.01_02.</p> </li> <li><p><a href="/5.40.0/POSIX">POSIX</a> has been upgraded from version 2.13 to 2.20.</p> <p>The <code>mktime</code> function now works correctly on 32-bit platforms even if the platform&#39;s <code>time_t</code> type is larger than 32 bits. [<a href="https://github.com/Perl/perl5/issues/21551">GH #21551</a>]</p> <p>The <code>T_SIGNO</code> and <code>T_FD</code> typemap entries have been fixed so they work with any variable name, rather than just the hardcoded <code>sig</code> and <code>fd</code>.</p> <p>The mappings for <code>Mode_t</code>, <code>pid_t</code>, <code>Uid_t</code>, <code>Gid_t</code> and <code>Time_t</code> have been updated to be integer types; previously they were <code>NV</code> floating-point.</p> <p>Adjusted the signbit() on NaN test to handle the unusual bit pattern returned for NaN by Oracle Developer Studio&#39;s compiler. [<a href="https://github.com/Perl/perl5/issues/21533">GH #21533</a>]</p> </li> <li><p><a href="/5.40.0/re">re</a> has been upgraded from version 0.44 to 0.47.</p> </li> <li><p><a href="/5.40.0/Safe">Safe</a> has been upgraded from version 2.44 to 2.46.</p> </li> <li><p><a href="/5.40.0/SelfLoader">SelfLoader</a> has been upgraded from version 1.26 to 1.27.</p> </li> <li><p><a href="/5.40.0/Socket">Socket</a> has been upgraded from version 2.036 to 2.038.</p> </li> <li><p><a href="/5.40.0/strict">strict</a> has been upgraded from version 1.12 to 1.13.</p> </li> <li><p><a href="/5.40.0/Test::Harness">Test::Harness</a> has been upgraded from version 3.44 to 3.48.</p> </li> <li><p><a href="/5.40.0/Test::Simple">Test::Simple</a> has been upgraded from version 1.302194 to 1.302199.</p> </li> <li><p><a href="/5.40.0/Text::Tabs">Text::Tabs</a> has been upgraded from version 2021.0814 to 2024.001.</p> </li> <li><p><a href="/5.40.0/Text::Wrap">Text::Wrap</a> has been upgraded from version 2021.0814 to 2024.001.</p> </li> <li><p><a href="/5.40.0/threads">threads</a> has been upgraded from version 2.36 to 2.40.</p> <p>An internal error has been made slightly more verbose (<code>Out of memory in perl:threads:ithread_create</code>).</p> </li> <li><p><a href="/5.40.0/threads::shared">threads::shared</a> has been upgraded from version 1.68 to 1.69.</p> </li> <li><p><a href="/5.40.0/Tie::File">Tie::File</a> has been upgraded from version 1.07 to 1.09.</p> <p>Old compatibility code for perl 5.005 that was no longer functional has been removed.</p> </li> <li><p><a href="/5.40.0/Time::gmtime">Time::gmtime</a> has been upgraded from version 1.04 to 1.05.</p> </li> <li><p><a href="/5.40.0/Time::HiRes">Time::HiRes</a> has been upgraded from version 1.9775 to 1.9777.</p> </li> <li><p><a href="/5.40.0/Time::Local">Time::Local</a> has been upgraded from version 1.30 to 1.35.</p> </li> <li><p><a href="/5.40.0/Time::localtime">Time::localtime</a> has been upgraded from version 1.03 to 1.04.</p> </li> <li><p><a href="/5.40.0/Time::tm">Time::tm</a> has been upgraded from version 1.00 to 1.01.</p> </li> <li><p><a href="/5.40.0/UNIVERSAL">UNIVERSAL</a> has been upgraded from version 1.15 to 1.17.</p> </li> <li><p><a href="/5.40.0/User::grent">User::grent</a> has been upgraded from version 1.04 to 1.05.</p> </li> <li><p><a href="/5.40.0/User::pwent">User::pwent</a> has been upgraded from version 1.02 to 1.03.</p> </li> <li><p><a href="/5.40.0/version">version</a> has been upgraded from version 0.9929 to 0.9930.</p> </li> <li><p><a href="/5.40.0/warnings">warnings</a> has been upgraded from version 1.65 to 1.69.</p> </li> <li><p><a href="/5.40.0/XS::APItest">XS::APItest</a> has been upgraded from version 1.32 to 1.36.</p> </li> <li><p><a href="/5.40.0/XS::Typemap">XS::Typemap</a> has been upgraded from version 0.19 to 0.20.</p> </li> </ul> <h1 id="Documentation"><a class="permalink" href="#Documentation">#</a>Documentation</h1> <h2 id="Changes-to-Existing-Documentation"><a class="permalink" href="#Changes-to-Existing-Documentation">#</a><a id="Changes"></a>Changes to Existing Documentation</h2> <p>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 <a href="https://github.com/Perl/perl5/issues">https://github.com/Perl/perl5/issues</a>.</p> <p>Additionally, the following selected changes have been made:</p> <h3 id="perlapi"><a class="permalink" href="#perlapi">#</a><a href="/5.40.0/perlapi">perlapi</a></h3> <ul> <li><p>Corrected the documentation for <a href="/5.40.0/perlapi#form"><code>Perl_form</code></a>, <code>form_nocontext</code>, and <code>vform</code>, which claimed that any later call to one of them will destroy the previous returns from any. This hasn&#39;t been true since 5.6.0, except it does remain true if these are called during global destruction. With that caveat, the return of each of these is a fresh string in a temporary that will automatically be freed by a call to <a href="/5.40.0/perlapi#FREETMPS">&quot;<code>FREETMPS</code>&quot; in perlapi</a> or at at places such as statement boundaries.</p> </li> <li><p>Several internal functions now have documentation - the various <code>newSUB</code> functions, <code>newANONLIST()</code>, <code>newANONHASH()</code>, <code>newSVREF()</code> and similar.</p> </li> </ul> <h3 id="perlclass"><a class="permalink" href="#perlclass">#</a><a href="/5.40.0/perlclass">perlclass</a></h3> <ul> <li><p>Added a list of known bugs in the experimental <code>class</code> feature.</p> </li> </ul> <h3 id="perlfunc"><a class="permalink" href="#perlfunc">#</a><a href="/5.40.0/perlfunc">perlfunc</a></h3> <ul> <li><p>The documentation for <a href="/5.40.0/perlfunc#local-EXPR"><code>local</code></a>, <a href="/5.40.0/perlfunc#my-VARLIST"><code>my</code></a>, <a href="/5.40.0/perlfunc#our-VARLIST"><code>our</code></a>, and <a href="/5.40.0/perlfunc#state-VARLIST"><code>state</code></a>, has been updated to include examples and descriptions of their effects within a statement.</p> </li> </ul> <h3 id="perlguts"><a class="permalink" href="#perlguts">#</a><a href="/5.40.0/perlguts">perlguts</a></h3> <ul> <li><p>A new section has been added which describes the experimental reference-counted argument stack build option (<code>PERL_RC_STACK</code>).</p> </li> </ul> <h3 id="perlclib"><a class="permalink" href="#perlclib">#</a><a href="/5.40.0/perlclib">perlclib</a></h3> <ul> <li><p>Extensive guidance has been added for interfacing with the standard C library, including many more functions to avoid, and how to cope with locales and threads.</p> </li> </ul> <h3 id="perlhacktips"><a class="permalink" href="#perlhacktips">#</a><a href="/5.40.0/perlhacktips">perlhacktips</a></h3> <ul> <li><p>Document we can&#39;t use compound literals or array designators due to C++ compatibility. [<a href="https://github.com/Perl/perl5/issues/21073">GH #21073</a>]</p> </li> <li><p>Document new functions <code>sv_mark_arenas()</code> and <code>sv_sweep_arenas()</code> (which only exist on <code>DEBUGGING</code> builds)</p> </li> <li><p>Added brief documentation for some tools useful when developing perl itself on Windows or Cygwin.</p> </li> </ul> <h3 id="perllol"><a class="permalink" href="#perllol">#</a><a href="/5.40.0/perllol">perllol</a></h3> <ul> <li><p>Removed indirect object syntax in <code>Dumpvalue</code> example</p> </li> </ul> <h3 id="perlre"><a class="permalink" href="#perlre">#</a><a href="/5.40.0/perlre">perlre</a></h3> <ul> <li><p>Removed statement suggesting <code>/p</code> is a no-op.</p> </li> </ul> <h3 id="perlref"><a class="permalink" href="#perlref">#</a><a href="/5.40.0/perlref">perlref</a></h3> <ul> <li><p>Documented ref assignment in list context (as part of the <code>refaliasing</code> feature)</p> </li> </ul> <h3 id="perlop"><a class="permalink" href="#perlop">#</a><a href="/5.40.0/perlop">perlop</a></h3> <ul> <li><p>The section on the empty pattern <code>//</code> has been amended to mention that the current dynamic scope is used to find the last successful match.</p> </li> </ul> <h3 id="perlport"><a class="permalink" href="#perlport">#</a><a href="/5.40.0/perlport">perlport</a></h3> <ul> <li><p>The <code>-S</code> file test has been meaningful on Win32 since 5.37.6</p> </li> <li><p>The <code>-l</code> file test is now meaningful on Win32</p> </li> <li><p>Some strange behaviour with <code>.</code> at the end of names under Windows has been documented</p> </li> </ul> <h3 id="perlvar"><a class="permalink" href="#perlvar">#</a><a href="/5.40.0/perlvar">perlvar</a></h3> <ul> <li><p>Added documentation for an alternative to <code>${^CAPTURE}</code></p> </li> </ul> <h1 id="Diagnostics"><a class="permalink" href="#Diagnostics">#</a>Diagnostics</h1> <p>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 <a href="/5.40.0/perldiag">perldiag</a>.</p> <h2 id="New-Diagnostics"><a class="permalink" href="#New-Diagnostics">#</a><a id="New4"></a>New Diagnostics</h2> <h3 id="New-Errors"><a class="permalink" href="#New-Errors">#</a><a id="New5"></a>New Errors</h3> <ul> <li><p><a href="/5.40.0/perldiag#Cannot-use-__CLASS__-outside-of-a-method-or-field-initializer-expression">Cannot use __CLASS__ outside of a method or field initializer expression</a></p> <p>(F) A <code>__CLASS__</code> expression yields the class name of the object instance executing the current method, and therefore it can only be placed inside an actual method (or method-like expression, such as a field initializer expression).</p> </li> <li><p><a href="/5.40.0/perldiag#get_layers%3A-unknown-argument-%27%25s%27">get_layers: unknown argument &#39;%s&#39;</a></p> <p>(F) You called PerlIO::get_layers() with an unknown argument. Legal arguments are provided in key/value pairs, with the keys being one of <code>input</code>, <code>output</code> or <code>detail</code>, followed by a boolean.</p> </li> <li><p><a href="/5.40.0/perldiag#UNIVERSAL-does-not-export-anything">UNIVERSAL does not export anything</a></p> <p>(F) You asked UNIVERSAL to export something, but UNIVERSAL is the base class for all classes and contains no exportable symbols.</p> </li> <li><p><a href="/5.40.0/perldiag#Builtin-version-bundle-%22%25s%22-is-not-supported-by-Perl">Builtin version bundle &quot;%s&quot; is not supported by Perl</a></p> <p>(F) You attempted to <code>use builtin :ver</code> for a version number that is either older than 5.39 (when the ability was added), or newer than the current perl version.</p> </li> <li><p><a href="/5.40.0/perldiag#Invalid-version-bundle-%22%25s%22">Invalid version bundle &quot;%s&quot;</a></p> <p>(F) A version number that is used to specify an import bundle during a <code>use builtin ...</code> statement must be formatted as <code>:MAJOR.MINOR</code> with an optional third component, which is ignored. Each component must be a number of 1 to 3 digits. No other characters are permitted. The value that was specified does not conform to these rules.</p> </li> <li><p><a href="/5.40.0/perldiag#Missing-comma-after-first-argument-to-return">Missing comma after first argument to return</a></p> <p>(F) While certain operators allow you to specify a filehandle or an &quot;indirect object&quot; before the argument list, <code>return</code> isn&#39;t one of them.</p> </li> <li><p><a href="/5.40.0/perldiag#Out-of-memory-during-vec-in-lvalue-context">Out of memory during vec in lvalue context</a></p> <p>(F) An attempt was made to extend a string beyond the largest possible memory allocation by assigning to <code>vec()</code> called with a large second argument.</p> <p>(This case used to throw a generic <code>Out of memory!</code> error.)</p> </li> <li><p><a href="/5.40.0/perldiag#Cannot-create-an-object-of-incomplete-class-%22%25s%22">Cannot create an object of incomplete class &quot;%s&quot;</a></p> <p>(F) An attempt was made to create an object of a class where the start of the class definition has been seen, but the class has not been completed.</p> <p>This can happen for a failed eval, or if you attempt to create an object at compile time before the class is complete:</p> <pre><code>eval &quot;class Foo {&quot;; Foo-&gt;new; # error class Bar { BEGIN { Bar-&gt;new } }; # error</code></pre> <p>Previously perl would assert or crash. [<a href="https://github.com/Perl/perl5/issues/22159">GH #22159</a>]</p> </li> </ul> <h3 id="New-Warnings"><a class="permalink" href="#New-Warnings">#</a><a id="New6"></a>New Warnings</h3> <ul> <li><p><a href="/5.40.0/perldiag#Forked-open-%27%25s%27-not-meaningful-in-%3C%3E">Forked open &#39;%s&#39; not meaningful in &lt;&gt;</a></p> <p>(S inplace) You had <code>|-</code> or <code>-|</code> in <code>@ARGV</code> and tried to use <code>&lt;&gt;</code> to read from it.</p> <p>Previously this would fork and produce a confusing error message. [<a href="https://github.com/Perl/perl5/issues/21176">GH #21176</a>]</p> </li> <li><p><a href="/5.40.0/perldiag#Attempt-to-call-undefined-%25s-method-with-arguments-(%22%25s%22%25s)-via-package-%22%25s%22-(Perhaps-you-forgot-to-load-the-package%3F)">Attempt to call undefined %s method with arguments (&quot;%s&quot;%s) via package &quot;%s&quot; (Perhaps you forgot to load the package?)</a></p> <p>(D deprecated::missing_import_called_with_args) You called the <code>import()</code> or <code>unimport()</code> method of a class that has no import method defined in its inheritance graph, and passed an argument to the method. This is very often the sign of a misspelled package name in a use or require statement that has silently succeeded due to a case insensitive file system.</p> <p>Another common reason this may happen is when mistakenly attempting to import or unimport a symbol from a class definition or package which does not use <code>Exporter</code> or otherwise define its own <code>import</code> or <code>unimport</code> method.</p> </li> </ul> <h2 id="Changes-to-Existing-Diagnostics"><a class="permalink" href="#Changes-to-Existing-Diagnostics">#</a><a id="Changes1"></a>Changes to Existing Diagnostics</h2> <ul> <li><p><a href="/5.40.0/perldiag#Name-%22%25s%3A%3A%25s%22-used-only-once%3A-possible-typo">Name &quot;%s::%s&quot; used only once: possible typo</a></p> <p>This warning now honors being marked as fatal. [<a href="https://github.com/Perl/perl5/issues/13814">GH #13814</a>]</p> </li> <li><p><a href="/5.40.0/perldiag#Out-of-memory-in-perl%3A%25s">Out of memory in perl:%s</a></p> <p>There used to be several places in the perl core that would print a generic <code>Out of memory!</code> message and abort when memory allocation failed, giving no indication which program it was that ran out of memory. These have been modified to include the word <code>perl</code> and the general area of the allocation failure, e.g. <code>Out of memory in perl:util:safesysrealloc</code>. [<a href="https://github.com/Perl/perl5/issues/21672">GH #21672</a>]</p> </li> <li><p><a href="/5.40.0/perldiag#Possible-precedence-issue-with-control-flow-operator-(%25s)">Possible precedence issue with control flow operator (%s)</a></p> <p>This warning now mentions the name of the control flow operator that triggered the diagnostic (e.g. <code>return</code>, <code>exit</code>, <code>die</code>, etc).</p> <p>It also covers more cases: Previously, the warning was only triggered if a low-precedence logical operator (like <code>and</code>, <code>or</code>, <code>xor</code>) was involved. Now it is also shown for misleading code like this:</p> <pre><code>exit $x ? 0 : 1; # actually parses as: exit($x) ? 0 : 1; exit $x == 0; # actually parses as: exit($x) == 0;</code></pre> </li> <li><p><a href="/5.40.0/perldiag#Use-of-uninitialized-value%25s">Use of uninitialized value%s</a></p> <p>This warning is now slightly more accurate in cases involving <code>length</code>, <code>pop</code>, <code>shift</code>, or <code>splice</code>:</p> <pre><code>my $x; length($x) == 0 # Before: # Use of uninitialized value $x in numeric eq (==) at ... # Now: # Use of uninitialized value length($x) in numeric eq (==) at ...</code></pre> <p>That is, the warning no longer implies that <code>$x</code> was used directly as an operand of <code>==</code>, which it wasn&#39;t.</p> <p>Similarly:</p> <pre><code>my @xs; shift @xs == 0 # Before: # Use of uninitialized value within @xs in numeric eq (==) at ... # Now: # Use of uninitialized value shift(@xs) in numeric eq (==) at ...</code></pre> <p>This is more accurate because there never was an <code>undef</code> within <code>@xs</code> as the warning implied. (The warning for <code>pop</code> works analogously.)</p> <p>Finally:</p> <pre><code>my @xs = (1, 2, 3); splice(@xs, 0, 0) == 0 # Before: # Use of uninitialized value within @xs in numeric eq (==) at ... # Now: # Use of uninitialized value in numeric eq (==) at ...</code></pre> <p>That is, in cases where <code>splice</code> returns <code>undef</code>, it no longer unconditionally blames its first argument. This was misleading because <code>splice</code> can return <code>undef</code> even if none of its arguments contain <code>undef</code>.</p> <p>[<a href="https://github.com/Perl/perl5/issues/21930">GH #21930</a>]</p> </li> <li><p><a href="/5.40.0/perldiag#Old-package-separator-%22%27%22-deprecated">Old package separator &quot;&#39;&quot; deprecated</a></p> <p>Prevent this warning appearing spuriously when checking the heuristic for the <a href="/5.40.0/perldiag#You-need-to-quote-%22%25s%22">You need to quote &quot;%s&quot;</a> warning.</p> <p>[<a href="https://github.com/Perl/perl5/issues/22145">GH #22145</a>]</p> </li> </ul> <h1 id="Configuration-and-Compilation"><a class="permalink" href="#Configuration-and-Compilation">#</a><a id="Configuration"></a>Configuration and Compilation</h1> <ul> <li><p><code>microperl</code>, long broken and of unclear present purpose, has been removed as promised in <a href="/5.40.0/perl5180delta#Future-Deprecations">Perl 5.18</a>.</p> </li> <li><p>Fix here-doc used for code to probe <code>LC_ALL</code> syntax for disparate locales introduced in 5.39.2. [<a href="https://github.com/Perl/perl5/issues/21451">GH #21451</a>]</p> </li> <li><p>You can now separately enable high water mark checks for non-DEBUGGING or disable them for DEBUGGING builds with <code>-Accflags=-DPERL_USE_HWM</code> or <code>-Accflags=-DPERL_NO_HWM</code> respectively. The default remains the same. [<a href="https://github.com/Perl/perl5/issues/16607">GH #16607</a>]</p> </li> </ul> <h1 id="Testing"><a class="permalink" href="#Testing">#</a>Testing</h1> <p>Tests were added and changed to reflect the other additions and changes in this release. Furthermore, these significant changes were made:</p> <ul> <li><p>Update <i>nm</i> output parsing for Darwin in <i>t/porting/libperl.t</i> to handle changes in the output of nm on Darwin. [<a href="https://github.com/Perl/perl5/issues/21117">GH #21117</a>]</p> </li> <li><p><i>t/op/magic.t</i> would fail when <code>ps</code> was the BusyBox implementation, since that doesn&#39;t support the <code>-p</code> flag and otherwise ignores a process id on the command-line. This caused <i>TEST</i> failures on BusyBox systems such as Alpine Linux. [<a href="https://github.com/Perl/perl5/issues/17542">GH #17542</a>]</p> </li> <li><p><i>porting/globvar.t</i> now uses the more portable <code>nm -P ...</code> to fetch the names defined in an object file. The parsing of the names found in the object is now separated from processing them to handle the duplication between local and global definitions on AIX. [<a href="https://github.com/Perl/perl5/issues/21637">GH #21637</a>]</p> </li> <li><p>A test was added to <i>lib/locale_threads.t</i> that extensively stress tests locale handling. It turns out that the libc implementations on various platforms have bugs in this regard, including Linux, Windows, *BSD derivatives including Darwin, and others. Experimental versions of this test have been used in the past few years to find bugs in the Perl implementation and in those platforms, as well as to develop workarounds in the Perl implementation, where feasible, for the platform bugs. Multiple bug report tickets have been filed against platforms, and some have been fixed. The test checks that platforms that purport to support thread-safe locale handling actually do so (and that perl works properly on those that do; The read-only variable <code>${^SAFE_LOCALES}</code> is set to 1 if perl thinks the platform can handle this, whatever the platform&#39;s documentation says).</p> <p>Also tested for is if the various locale categories can indeed be set independently to disparate locales. (An example of where you might want to do this is if you are a Western Canadian living and working in Holland. You likely will want to have the <code>LC_MONETARY</code> locale be set to where you are living, but have the other parts of your locale retain your native English values. Later, as you get a bit more comfortable with Dutch, and in order to communicate better with your colleagues, you might want to change <code>LC_TIME</code> and <code>LC_NUMERIC</code> to Dutch, while leaving <code>LC_CTYPE</code> and <code>LC_COLLATE</code> set to English indefinitely.)</p> </li> <li><p>The test <i>t/porting/libperl.t</i> will no longer run in maint releases. This test is sensitive to changes in the output of <i>nm</i> on various platforms, and tarballs aren&#39;t updated as we update this test in blead. [<a href="https://github.com/Perl/perl5/issues/21677">GH #21677</a>]</p> </li> </ul> <h1 id="Platform-Support"><a class="permalink" href="#Platform-Support">#</a><a id="Platform"></a>Platform Support</h1> <h2 id="New-Platforms"><a class="permalink" href="#New-Platforms">#</a><a id="New7"></a>New Platforms</h2> <dl> <dt id="Serenity-OS"><a class="permalink" href="#Serenity-OS">#</a><a id="Serenity"></a>Serenity OS</dt> <dd> <p>Out of the box support for Serenity OS was added.</p> </dd> </dl> <h2 id="Platform-Specific-Notes"><a class="permalink" href="#Platform-Specific-Notes">#</a><a id="Platform1"></a>Platform-Specific Notes</h2> <dl> <dt id="Windows"><a class="permalink" href="#Windows">#</a>Windows</dt> <dd> <p>Eliminated several header build warnings under MSVC with <code>/W4</code> to reduce noise for embedders. [<a href="https://github.com/Perl/perl5/issues/21031">GH #21031</a>]</p> <p>Work around a bug in most 32-bit Mingw builds, where the generated code, including the code in the gcc support library, assumes 16-byte stack alignment, which 32-bit Windows does not preserve. [<a href="https://github.com/Perl/perl5/issues/21313">GH #21313</a>]</p> <p>Enable <code>copysign</code>, <code>signbit</code>, <code>acosh</code>, <code>asinh</code>, <code>atanh</code>, <code>exp2</code>, <code>tgamma</code> in the bundled configuration used for MSVC. [<a href="https://github.com/Perl/perl5/issues/21610">GH #21610</a>]</p> <p>The build process no longer supports Visual Studio 2013. This was failing to build at a very basic level and there have been no reports of such failures. [<a href="https://github.com/Perl/perl5/issues/21624">GH #21624</a>]</p> </dd> <dt id="Linux"><a class="permalink" href="#Linux">#</a>Linux</dt> <dd> <p>The hints file has been updated to handle the Intel oneAPI DPC++/C++ compiler.</p> </dd> <dt id="MacOS/Darwin"><a class="permalink" href="#MacOS/Darwin">#</a><a id="MacOS"></a><a id="MacOS-Darwin"></a>MacOS/Darwin</dt> <dd> <p>Don&#39;t set <code>MACOSX_DEPLOYMENT_TARGET</code> when building on OS X 10.5. [<a href="https://github.com/Perl/perl5/issues/21367">GH #21367</a>]</p> </dd> <dt id="VMS"><a class="permalink" href="#VMS">#</a>VMS</dt> <dd> <p>Fixed the configure &quot;installation prefix&quot; prompt to accept a string rather than yes/no.</p> <p>Fixed compilation by defining proper value for <code>perl_lc_all_category_positions_init</code>.</p> <p>Increased buffer size when reading <i>config_H.SH</i> to fix compilation under clang.</p> </dd> <dt id="Oracle-Developer-Studio-(Solaris,-Oracle-Linux)"><a class="permalink" href="#Oracle-Developer-Studio-(Solaris,-Oracle-Linux)">#</a><a id="Oracle"></a><a id="Oracle-Developer-Studio-Solaris-Oracle-Linux"></a>Oracle Developer Studio (Solaris, Oracle Linux)</dt> <dd> <p>Due to an apparent code generation bug, the default optimization level for the Oracle Developer Studio (formerly Sun Workshop) compiler is now <code>-xO1</code>. [<a href="https://github.com/Perl/perl5/issues/21535">GH #21535</a>]</p> </dd> </dl> <h1 id="Internal-Changes"><a class="permalink" href="#Internal-Changes">#</a><a id="Internal"></a>Internal Changes</h1> <ul> <li><p><code>PERL_RC_STACK</code> build option added.</p> <p>This new build option is highly experimental and is not enabled by default. Perl can be built with it by using the <i>Configure</i> option <code>-Accflags=&#39;-DPERL_RC_STACK&#39;</code>.</p> <p>It makes the argument stack bump the reference count of SVs pushed onto it. It is mostly functional, but currently slow and incomplete.</p> <p>It is intended in the long term that this build option will become the default option, and then finally the only option; but this will be many releases away.</p> <p>In particular, there is currently no support within XS code for using these new features. So under this build option, all XS functions are called via a backwards-compatibility wrapper which slows down such calls.</p> <p>In future releases, better support for XS code is intended to be added. It is expected that straightforward XS code will eventually be able to make use of a reference-counted stack without modification, with any heavy lifting being handled by the XS compiler (<code>xsubpp</code>) and the macros which it outputs. But code which implements PP() functions will eventually have to be modified to use a new PP API: rpp_foo() rather than PUSHs() etc. But this new API is not yet stable, nor has it yet been back-ported via <code>Devel::PPPort</code>.</p> <p>See <a href="/5.40.0/perlguts#Reference-counted-argument-stack">perlguts</a> for more details.</p> </li> <li><p>A new API function has been added that simplifies C (or XS) code that creates <code>LISTOP</code> optree fragments. <code>newLISTOPn()</code> is a variadic function that takes a <code>NULL</code>-terminated list of child op pointers, and constructs a new checked <code>LISTOP</code> to contain them all. This is simpler than creating a new plain <code>OP_LIST</code>, adding each child individually, and finally calling <code>op_convert_list()</code> in most code fragments.</p> </li> <li><p>The <code>eval_sv()</code> API now accepts the <code>G_USEHINTS</code> flag, which uses the hints such as strict and features from <code>PL_curcop</code> instead of the default, which is to use default hints, e.g. no <code>use vX.XX;</code>, no strict, default features.</p> <p>Beware if you use this flag in XS code: your evaluated code will need to support whatever strictness or features are in effect at the point your XS function is called.</p> <p>[<a href="https://github.com/Perl/perl5/issues/21415">GH #21415</a>]</p> </li> <li><p><code>PERL_VERSION_LE</code> has been fixed to properly check for &quot;less than or equal&quot; rather than &quot;less than&quot;.</p> </li> <li><p><code>dAX</code>, <code>dITEMS</code> and hence <code>dXSARGS</code> now declare <code>AX</code> and <code>items</code> as <code>Stack_off_t</code> rather than <code>SSize_t</code>. This reverts back to compatibility with pre-64-bit stack support for default builds of perl where <code>Stack_off_t</code> is <code>I32</code>. [<a href="https://github.com/Perl/perl5/issues/21782">GH #21782</a>]</p> </li> <li><p>A new function is now available to <code>XS</code> code, <a href="/5.40.0/perlapi#sv_langinfo">&quot;sv_langinfo&quot; in perlapi</a>. This provides the same information as the existing <a href="/5.40.0/perlapi#Perl_langinfo8">&quot;Perl_langinfo8&quot; in perlapi</a>, but returns an SV instead of a <span style="white-space: nowrap;"><code>char *</code></span>, so that programmers don&#39;t have to concern themselves with the UTF-8ness of the result. This new function is now the preferred interface for <code>XS</code> code to the <a href="http://man.he.net/man3/nl_langinfo">nl_langinfo(3)</a> <code>libc</code> function. From Perl space, this information continues to be provided by the <a href="/5.40.0/I18N::Langinfo">I18N::Langinfo</a> module.</p> </li> <li><p>glibc has an undocumented equivalent function to querylocale(), which our experience indicates is reliable. When this is function is used, it removes the need for perl to keep its own records, hence is more efficient and guaranteed to be accurate. Use of this function can be disabled by defining the <code>NO_NL_LOCALE_NAME</code> build option</p> </li> </ul> <h1 id="Selected-Bug-Fixes"><a class="permalink" href="#Selected-Bug-Fixes">#</a><a id="Selected"></a>Selected Bug Fixes</h1> <ul> <li><p>The delimiter <code>SYRIAC COLON SKEWED LEFT/RIGHT</code> pair has been removed from the ones recognized by the <code>extra_paired_delimiters</code> feature. (See <a href="/5.40.0/perlop#Quote-and-Quote-like-Operators">&quot;Quote and Quote-like Operators&quot; in perlop</a>.) This is because those characters are normally written right-to-left, and this could be visually confusing [<a href="https://github.com/Perl/perl5/issues/22228">GH #22228</a>]. The change was actually to forbid any right-to-left delimiters, but this pair is the only current instance that meets this criterion. By policy, this change means that the <code>extra_paired_delimiters</code> feature cannot be considered to have been stable long enough for its experimental status to be removed.</p> </li> <li><p><code>use 5.36;</code> or later didn&#39;t enable the post parse reporting of <a href="/5.40.0/perldiag#Name-%22%25s%3A%3A%25s%22-used-only-once%3A-possible-typo">Name &quot;%s::%s&quot; used only once: possible typo</a> warnings when enabling warnings. [<a href="https://github.com/Perl/perl5/issues/21271">GH #21271</a>]</p> </li> <li><p>Fix a crash or assertion when cleaning up a closure that refers to an outside <code>our</code> sub. [<a href="https://github.com/Perl/perl5/issues/21067">GH #21067</a>]</p> </li> <li><p>Fixed a number of issues where <code>I32</code> was used as a string offset or size rather than <code>SSize_t</code> or <code>STRLEN</code>/<code>size_t</code> [<a href="https://github.com/Perl/perl5/issues/21012">GH #21012</a>]</p> </li> <li><p><code>~$str</code> when <code>$str</code> was more than 2GB in size would do nothing or produce an incomplete result.</p> </li> <li><p>String repeat, <code>$str x $count</code>, didn&#39;t handle <code>$str</code> over 2GB in size, throwing an error. Now such strings are repeated.</p> </li> <li><p>Complex substitution after the 2GB point in a string could access incorrect or invalid offsets in the string.</p> </li> <li><p>sv_utf8_decode() would truncate the SVs pos() value. This wasn&#39;t visible via utf8::decode().</p> </li> <li><p>When compiling a constant folded hash key, the length was truncated when creating the shared SV. Since hash keys over 2GB are not supported, throw a compilation error instead.</p> </li> <li><p>msgrcv() incorrectly called get magic on the buffer SV and failed to call set magic on completion. [<a href="https://github.com/Perl/perl5/issues/21012">GH #21012</a>]</p> </li> <li><p>msgrcv() used the size parameter to resize the buffer before validating it. [<a href="https://github.com/Perl/perl5/issues/21012">GH #21012</a>]</p> </li> <li><p>Inheriting from a class that was hierarchically an ancestor of the new class, eg. <code> class A::B :isa(A) { ... } </code>, would not attempt to load the parent class. [<a href="https://github.com/Perl/perl5/issues/21332">GH #21332</a>]</p> </li> <li><p>Declared references can now be used with <code>state</code> variables. [<a href="https://github.com/Perl/perl5/issues/21351">GH #21351</a>]</p> </li> <li><p>Trailing elements in an <code>unshift</code>ed and resized array will now always be initialized. [<a href="https://github.com/Perl/perl5/issues/21265">GH #21265</a>]</p> </li> <li><p>Make <code>use 5.036</code> respect the -X flag</p> <p>perl&#39;s -X flag disables all warnings globally, but 芦use 5.036禄 didn&#39;t respect that until now. [<a href="https://github.com/Perl/perl5/issues/21431">GH #21431</a>]</p> </li> <li><p>Fixed an OP leak when an error was produced for initializer for a class field. [<a href="https://github.com/Perl/perl5/issues/20812">GH #20812</a>]</p> </li> <li><p>Fixed a leak of the return value when smartmatching against a code reference.</p> </li> <li><p>Fixed a slowdown in repeated substitution replacements using special variables, such as <code>s/....x$1/g</code>. It actually makes all string concatenations involving such &quot;magic&quot; variables less slow, but the slowdown was more noticeable on repeated substitutions due to extra memory usage that was only freed after the last iteration. The slowdown started in perl 5.28.0 - which generally sped up string concatenation but slowed down when using special variables. [<a href="https://github.com/Perl/perl5/issues/21360">GH #21360</a>]</p> </li> <li><p>Lexical names from the enclosing scope in a lexical sub or closure weren&#39;t visible to code executed by calling <code>eval EXPR;</code> from the <code>DB</code> package. This was introduced in 5.18 in an attempt to prevent subs from retaining a reference to their outer scope, but this broke the special behaviour of <code>eval EXPR;</code> in package DB.</p> <p>This incidentally fixed a TODO test for <code>B::Deparse</code>. [<a href="https://github.com/Perl/perl5/pull/19370">GH #19370</a>]</p> </li> <li><p>Optionally support an argument stack over 2**32 entries on 64-bit platforms. This requires 32GB of memory just for the argument stack pointers itself, so you will require a significantly more memory to take advantage of this.</p> <p>To enable this add <code>-Accflags=-DPERL_STACK_OFFSET_SSIZET</code> or equivalent to the <code>Configure</code> command-line.</p> <p>[<a href="https://github.com/Perl/perl5/issues/20917">GH #20917</a>] [<a href="https://github.com/Perl/perl5/issues/21523">GH #21523</a>]</p> </li> <li><p>Fixed various problems with join() where modifications to the separator could be handled inconsistently, or could access released memory. Changes to the separator from magic or overloading for values in the <code>LIST</code> no longer have an effect on the resulting joined string. [<a href="https://github.com/Perl/perl5/issues/21458">GH #21458</a>]</p> </li> <li><p>Don&#39;t clear the integer flag <code>IOK</code> from lines in the <code>@{&quot;_&lt;$sourcefile&quot;}</code> array when a <code>dbstate</code> op is removed for that line. This was broken when fixing [<a href="https://github.com/Perl/perl5/issues/19198">GH #19198</a>]. [<a href="https://github.com/Perl/perl5/issues/21564">GH #21564</a>]</p> </li> <li><p>Many bug fixes have been made for using locales under threads and in embedded perls. And workarounds for libc bugs have been added. As a result thread-safe locale handling is now the default under OpenBSD, and MingW when compiled with UCRT.</p> <p>However, testing has shown that Darwin&#39;s implementation of thread-safe locale handling has bugs. So now Perl doesn&#39;t attempt to use the thread-safe operations when compiled on Darwin.</p> <p>As before, you can check to see if your program is running with thread-safe locales by checking if the value of <code>${^SAFE_LOCALES}</code> is 1.</p> </li> <li><p>Various bugs have been fixed when perl is configured with <code>-Accflags=-DNO_LOCALE_NUMERIC</code> or any other locale category (or categories).</p> </li> <li><p>Not all locale categories need be set to the same locale. Perl now works around bugs in the libc implementations of locale handling on some platforms that previously could result in mojibake.</p> </li> <li><p><code>LC_ALL</code> is represented in one of two ways when not all locale categories are set to the same locale. On some platforms, such as Linux and Windows, the representation is of the form of a series of <code>&#39;category=locale-name&#39;</code> pairs. On other platforms, such as *BSD, the representation is positional like <span style="white-space: nowrap;"><code><i>name1</i> / <i>name2</i> / ... </code></span>. <i>name1</i> is always for a particular category as defined by the platform, as are the other names. The sequence that separates the names (the <span style="white-space: nowrap;"><code> / </code></span> above) also varies by platform. Previously, perl had problems with platforms that used the positional notation. This is now fixed.</p> </li> <li><p>A bug has been fixed in the regexp engine with an optimisation that applies to the <code>+</code> quantifier where it was followed by a <code>(*SKIP)</code> pattern.</p> <p>[<a href="https://github.com/Perl/perl5/issues/21534">GH #21534</a>]</p> </li> <li><p>The tmps (mortal) stack now grows exponentially. Previously it grew linearly, so if it was growing incrementally, such as through many calls to sv_2mortal(), on a system where realloc() is O(size), the performance would be O(n*n). With exponential grows this changes to amortized O(n). [<a href="https://github.com/Perl/perl5/issues/21654">GH #21654</a>]</p> </li> <li><p>Lexical subs now have a new stub in the pad for each recursive call into the containing function. This fixes two problems:</p> <ul> <li><p>If the lexical sub called the containing function, a &quot;Can&#39;t undef active subroutine&quot; error would be thrown. For example:</p> <pre><code>use v5.36.0; sub outer($oc) { my sub inner ($c) { outer($c-1) if $c; # Can&#39;t undef active subroutine } inner($oc); } outer(2);</code></pre> <p>[<a href="https://github.com/Perl/perl5/issues/18606">GH #18606</a>]</p> </li> <li><p>If the lexical sub was called from a recursive call into the containing function, this would overwrite the bindings to the closed over variables in the lexical sub, so calls into the lexical sub from the outer recursive call would have access to the variables from the inner recursive call:</p> <pre><code>use v5.36.0; sub outer ($x) { my sub inner ($label) { say &quot;$label $x&quot;; } inner(&quot;first&quot;); outer(&quot;inner&quot;) if $x eq &quot;outer&quot;; # this call to inner() sees the wrong $x inner(&quot;second&quot;); } outer(&quot;outer&quot;);</code></pre> <p>[<a href="https://github.com/Perl/perl5/issues/21987">GH #21987</a>]</p> </li> </ul> </li> <li><p>prepare_export_lexical() was separately saving <code>PL_comppad</code> and <code>PL_curpad</code>, this could result in <code>PL_curpad</code> being restored to a no longer valid value, resulting in a panic when importing lexicals in some cases. [<a href="https://github.com/Perl/perl5/issues/21981">GH #21981</a>]</p> </li> <li><p>A string eval() operation in the scope of a <code>use VERSION</code> declaration would sometimes emit spurious &quot;Downgrading a use VERSION declaration&quot; warnings due to an inconsistency in the way the version number was stored. This is now fixed. [<a href="https://github.com/Perl/perl5/issues/22121">GH #22121</a>]</p> </li> </ul> <h1 id="Known-Problems"><a class="permalink" href="#Known-Problems">#</a><a id="Known"></a>Known Problems</h1> <ul> <li><p>perlivp is missing streamzip on Windows</p> <p>The <code>streamzip</code> utility does not get installed on Windows but should get installed.</p> </li> </ul> <h1 id="Errata-From-Previous-Releases"><a class="permalink" href="#Errata-From-Previous-Releases">#</a><a id="Errata"></a>Errata From Previous Releases</h1> <ul> <li><p><a href="/5.40.0/perl5300delta">perl5300delta</a> has been updated to include the removal of the <code>arybase</code> module that happened at the same time as the removal of <code>$[</code>.</p> </li> </ul> <h1 id="Acknowledgements"><a class="permalink" href="#Acknowledgements">#</a>Acknowledgements</h1> <p>Perl 5.40.0 represents approximately 11 months of development since Perl 5.38.0 and contains approximately 160,000 lines of changes across 1,500 files from 75 authors.</p> <p>Excluding auto-generated files, documentation and release tools, there were approximately 110,000 lines of changes to 1,200 .pm, .t, .c and .h files.</p> <p>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.40.0:</p> <p>Abe Timmerman, Alexander Kanavin, Amory Meltzer, Aristotle Pagaltzis, Arne Johannessen, Beckett Normington, Bernard Quatermass, Bernd, Bruno Meneguele, Chad Granum, Chris &#39;BinGOs&#39; Williams, Christoph Lamprecht, Craig A. Berry, Dagfinn Ilmari Manns氓ker, Dan Book, Dan Church, Daniel B枚hmer, Dan Jacobson, Dan Kogai, David Golden, David Mitchell, E. Choroba, Elvin Aslanov, Erik Huelsmann, Eugen Konkov, Gianni Ceccarelli, Graham Knop, Greg Kennedy, guoguangwu, Hauke D, H.Merijn Brand, Hugo van der Sanden, iabyn, Jake Hamby, Jakub Wilk, James E Keenan, James Raspass, Joe McMahon, Johan Vromans, John Karr, Karen Etheridge, Karl Williamson, Leon Timmermans, Lukas Mai, Marco Fontani, Marek Rouchal, Martijn Lievaart, Mathias Kende, Matthew Horsfall, Max Maischein, Nicolas Mendoza, Nicolas R, OpossumPetya, Paul Evans, Paul Marquess, Peter John Acklam, Philippe Bruhat (BooK), Raul E Rangel, Renee Baecker, Ricardo Signes, Richard Leach, Scott Baker, Sevan Janiyan, Sisyphus, Steve Hay, TAKAI Kousuke, Todd Rinaldo, Tomasz Konojacki, Tom Hughes, Tony Cook, William Lyu, x-yuri, Yves Orton, Zakariyya Mughal, 袛懈谢褟薪 袩邪谢邪褍蟹芯胁.</p> <p>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.</p> <p>Many of the changes included in this version originated in the CPAN modules included in Perl&#39;s core. We&#39;re grateful to the entire CPAN community for helping Perl to flourish.</p> <p>For a more complete list of all of Perl&#39;s historical contributors, please see the <i>AUTHORS</i> file in the Perl source distribution.</p> <h1 id="Reporting-Bugs"><a class="permalink" href="#Reporting-Bugs">#</a><a id="Reporting"></a>Reporting Bugs</h1> <p>If you find what you think is a bug, you might check the perl bug database at <a href="https://github.com/Perl/perl5/issues">https://github.com/Perl/perl5/issues</a>. There may also be information at <a href="https://www.perl.org/">https://www.perl.org/</a>, the Perl Home Page.</p> <p>If you believe you have an unreported bug, please open an issue at <a href="https://github.com/Perl/perl5/issues">https://github.com/Perl/perl5/issues</a>. Be sure to trim your bug down to a tiny but sufficient test case.</p> <p>If the bug you are reporting has security implications which make it inappropriate to send to a public issue tracker, then see <a href="/5.40.0/perlsec#SECURITY-VULNERABILITY-CONTACT-INFORMATION">&quot;SECURITY VULNERABILITY CONTACT INFORMATION&quot; in perlsec</a> for details of how to report the issue.</p> <h1 id="Give-Thanks"><a class="permalink" href="#Give-Thanks">#</a><a id="Give"></a>Give Thanks</h1> <p>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 <code>perlthanks</code> program:</p> <pre><code class="plaintext">perlthanks</code></pre> <p>This will send an email to the Perl 5 Porters list with your show of thanks.</p> <h1 id="SEE-ALSO"><a class="permalink" href="#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1> <p>The <i>Changes</i> file for an explanation of how to view exhaustive details on what changed.</p> <p>The <i>INSTALL</i> file for how to build Perl.</p> <p>The <i>README</i> file for general stuff.</p> <p>The <i>Artistic</i> and <i>Copying</i> files for copyright information.</p> </div> <div id="footer"> <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p> <p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> <script src="/highlight.pack.js"></script> <script>hljs.highlightAll();</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10