NAME
perldelta - what is new for perl v5.39.8
DESCRIPTION
This document describes differences between the 5.39.7 release and the 5.39.8 release.
If you are upgrading from an earlier release such as 5.39.6, first read perl5397delta, which describes differences between 5.39.6 and 5.39.7.
Core Enhancements
:reader
attribute for field variables
When using the class
feature, field variables can now take a :reader
attribute. This requests that an accessor method be automatically created that simply returns the value of the field variable from the given instance.
field $name :reader;
Is equivalent to
field $name;
method name () { return $name; }
An alternative name can also be provided:
field $name :reader(get_name);
For more detail, see ":reader" in perlclass.
Permit a space in -M
command-line option
When processing command-line options, perl now allows a space between the -M
switch and the name of the module after it.
$ perl -M Data::Dumper=Dumper -E 'say Dumper [1,2,3]'
This matches the existing behaviour of the -I
option.
Restrictions to use VERSION
declarations
In Perl 5.36, a deprecation warning was added when downgrading a use VERSION
declaration from one above version 5.11, to below. This has now been made a fatal error.
Additionally, it is now a fatal error to issue a subsequent use VERSION
declaration when another is in scope, when either version is 5.39 or above. This is to avoid complications surrounding imported lexical functions from builtin. A deprecation warning has also been added for any other subsequent use VERSION
declaration below version 5.39, to warn that it will no longer be permitted in Perl version 5.46.
use VERSION
no longer removes imported builtin
functions
For a few development versions we have experimented with the idea that as well as importing lexical functions, the use VERSION
syntax can also remove previously imported functions when a new version is requested that does not include them. This behaviour of removing lexical functions has turned out to be a bad model to follow so this version of Perl removes it again.
As this behaviour has not appeared in any stable release of Perl, no warning or deprecation period is required.
New builtin::inf
and builtin::nan
functions
Two new functions, inf
and nan
, have been added to the builtin
namespace. These act like constants that yield the floating-point infinity and Not-a-Number value respectively.
Incompatible Changes
Class barewords no longer resolved as file handles in method calls under no feature "bareword_filehandles"
Under no feature "bareword_filehandles"
bareword file handles continued to be resolved in method calls:
open FH, "<", $somefile or die;
no feature 'bareword_filehandles';
FH->binmode;
This has been fixed, so the:
FH->binmode;
will attempt to resolve FH
as a class, typically resulting in a runtime error.
The standard file handles such as STDOUT
continue to be resolved as a handle:
no feature 'bareword_filehandles';
STDOUT->flush; # continues to work
Note that once perl resolves a bareword name as a class it will continue to do so:
package SomeClass {
sub somemethod{}
}
open SomeClass, "<", "somefile" or die;
# SomeClass resolved as a handle
SomeClass->binmode;
{
no feature "bareword_filehandles";
SomeClass->somemethod;
}
# SomeClass resolved as a class
SomeClass->binmode;
Modules and Pragmata
Updated Modules and Pragmata
attributes has been upgraded from version 0.35 to 0.36.
B::Deparse has been upgraded from version 1.74 to 1.75.
builtin has been upgraded from version 0.012 to 0.014.
DynaLoader has been upgraded from version 1.54 to 1.55.
File::Glob has been upgraded from version 1.41 to 1.42.
Hash::Util has been upgraded from version 0.31 to 0.32.
Hash::Util::FieldHash has been upgraded from version 1.26 to 1.27.
Module::CoreList has been upgraded from version 5.20240120 to 5.20240223.
mro has been upgraded from version 1.28 to 1.29.
perlfaq has been upgraded from version 5.20230812 to 5.20240218.
PerlIO::encoding has been upgraded from version 0.30 to 0.31.
Pod::Checker has been upgraded from version 1.76 to 1.77.
POSIX has been upgraded from version 2.17 to 2.18.
Safe has been upgraded from version 2.45 to 2.46.
Tie::File has been upgraded from version 1.07 to 1.08.
warnings has been upgraded from version 1.67 to 1.68.
XS::APItest has been upgraded from version 1.34 to 1.35.
I18N::Langinfo has been upgraded from version 0.23 to 0.24.
This fixes what is returned for the
ALT_DIGITS
item, which has never before worked properly in Perl.
Documentation
Changes to Existing Documentation
We have attempted to update the documentation to reflect the changes listed in this document. If you find any we have missed, open an issue at https://github.com/Perl/perl5/issues.
Diagnostics
The following additions or changes have been made to diagnostic output, including warnings and fatal error messages. For the complete list of diagnostic messages, see perldiag.
New Diagnostics
New Warnings
Lexical subroutine %s masks previously declared package subroutine
The current package already contains a subroutine whose name matches that of a newly-declared lexical or lexically imported subroutine. The latter will take precedence and make the package one inaccessible by name.
Changes to Existing Diagnostics
-
This warning is now slightly more accurate in cases involving
length
,pop
,shift
, orsplice
: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 ...
That is, the warning no longer implies that
$x
was used directly as an operand of==
, which it wasn't.Similarly:
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 ...
This is more accurate because there never was an
undef
within@xs
as the warning implied. (The warning forpop
works analogously.)Finally:
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 ...
That is, in cases where
splice
returnsundef
, it no longer unconditionally blames its first argument. This was misleading becausesplice
can returnundef
even if none of its arguments containundef
.
Selected Bug Fixes
Lexical subs now have a new stub in the pad for each recursive call into the containing function. This fixes two problems:
If the lexical sub called the containing function, a "Can't undef active subroutine" error would be thrown. For example:
use v5.36.0; sub outer($oc) { my sub inner ($c) { outer($c-1) if $c; # Can't undef active subroutine } inner($oc); } outer(2);
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:
use v5.36.0; sub outer ($x) { my sub inner ($label) { say "$label $x"; } inner("first"); outer("inner") if $x eq "outer"; # this call to inner() sees the wrong $x inner("second"); } outer("outer");
Acknowledgements
Perl 5.39.8 represents approximately 5 weeks of development since Perl 5.39.7 and contains approximately 9,100 lines of changes across 170 files from 24 authors.
Excluding auto-generated files, documentation and release tools, there were approximately 4,900 lines of changes to 79 .pm, .t, .c and .h files.
Perl continues to flourish into its fourth decade thanks to a vibrant community of users and developers. The following people are known to have contributed the improvements that became Perl 5.39.8:
Chris 'BinGOs' Williams, Craig A. Berry, Daniel Böhmer, Dan Jacobson, David Mitchell, Elvin Aslanov, Graham Knop, H.Merijn Brand, James E Keenan, John Karr, Karen Etheridge, Karl Williamson, Leon Timmermans, Lukas Mai, Marek Rouchal, Mathias Kende, Max Maischein, Paul Evans, Renee Baecker, Richard Leach, Sisyphus, TAKAI Kousuke, Tony Cook, Yves Orton.
The list above is almost certainly incomplete as it is automatically generated from version control history. In particular, it does not include the names of the (very much appreciated) contributors who reported issues to the Perl bug tracker.
Many of the changes included in this version originated in the CPAN modules included in Perl's core. We're grateful to the entire CPAN community for helping Perl to flourish.
For a more complete list of all of Perl's historical contributors, please see the AUTHORS file in the Perl source distribution.
Reporting Bugs
If you find what you think is a bug, you might check the perl bug database at https://github.com/Perl/perl5/issues. There may also be information at https://www.perl.org/, the Perl Home Page.
If you believe you have an unreported bug, please open an issue at https://github.com/Perl/perl5/issues. Be sure to trim your bug down to a tiny but sufficient test case.
If the bug you are reporting has security implications which make it inappropriate to send to a public issue tracker, then see "SECURITY VULNERABILITY CONTACT INFORMATION" in perlsec for details of how to report the issue.
Give Thanks
If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, you can do so by running the perlthanks
program:
perlthanks
This will send an email to the Perl 5 Porters list with your show of thanks.
SEE ALSO
The Changes file for an explanation of how to view exhaustive details on what changed.
The INSTALL file for how to build Perl.
The README file for general stuff.
The Artistic and Copying files for copyright information.