=encoding utf8 =head1 NAME perldelta - what is new for perl v5.39.8 =head1 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 L, which describes differences between 5.39.6 and 5.39.7. =head1 Core Enhancements =head2 C<:reader> attribute for field variables When using the C feature, field variables can now take a C<: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 L. =head2 Permit a space in C<-M> command-line option When processing command-line options, perl now allows a space between the C<-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 C<-I> option. =head2 Restrictions to C declarations In Perl 5.36, a deprecation warning was added when downgrading a C 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 C declaration when another is in scope, when either version is 5.39 or above. This is to avoid complications surrounding imported lexical functions from L. A deprecation warning has also been added for any other subsequent C declaration below version 5.39, to warn that it will no longer be permitted in Perl version 5.46. =head2 C no longer removes imported C functions For a few development versions we have experimented with the idea that as well as importing lexical functions, the C 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. =head2 New C and C functions Two new functions, C and C, have been added to the C namespace. These act like constants that yield the floating-point infinity and Not-a-Number value respectively. =head1 Incompatible Changes =head2 Class barewords no longer resolved as file handles in method calls under C Under C 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 C as a class, typically resulting in a runtime error. The standard file handles such as C 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; [L] =head1 Modules and Pragmata =head2 Updated Modules and Pragmata =over 4 =item * L has been upgraded from version 0.35 to 0.36. =item * L has been upgraded from version 1.74 to 1.75. =item * L has been upgraded from version 0.012 to 0.014. =item * L has been upgraded from version 1.54 to 1.55. =item * L has been upgraded from version 1.41 to 1.42. =item * L has been upgraded from version 0.31 to 0.32. =item * L has been upgraded from version 1.26 to 1.27. =item * L has been upgraded from version 5.20240120 to 5.20240223. =item * L has been upgraded from version 1.28 to 1.29. =item * L has been upgraded from version 5.20230812 to 5.20240218. =item * L has been upgraded from version 0.30 to 0.31. =item * L has been upgraded from version 1.76 to 1.77. =item * L has been upgraded from version 2.17 to 2.18. =item * L has been upgraded from version 2.45 to 2.46. =item * L has been upgraded from version 1.07 to 1.08. =item * L has been upgraded from version 1.67 to 1.68. =item * L has been upgraded from version 1.34 to 1.35. =item * L has been upgraded from version 0.23 to 0.24. This fixes what is returned for the C item, which has never before worked properly in Perl. =back =head1 Documentation =head2 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 L. =head1 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 L. =head2 New Diagnostics =head3 New Warnings =over 4 =item * L 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. =back =head2 Changes to Existing Diagnostics =over 4 =item * L This warning is now slightly more accurate in cases involving C, C, C, or C: 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 C<$x> was used directly as an operand of C<==>, 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 C within C<@xs> as the warning implied. (The warning for C 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 C returns C, it no longer unconditionally blames its first argument. This was misleading because C can return C even if none of its arguments contain C. [L] =back =head1 Selected Bug Fixes =over 4 =item * Lexical subs now have a new stub in the pad for each recursive call into the containing function. This fixes two problems: =over =item * 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); [L] =item * 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"); [L] =back =back =head1 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 F file in the Perl source distribution. =head1 Reporting Bugs If you find what you think is a bug, you might check the perl bug database at L. There may also be information at L, the Perl Home Page. If you believe you have an unreported bug, please open an issue at L. 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 L for details of how to report the issue. =head1 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 C program: perlthanks This will send an email to the Perl 5 Porters list with your show of thanks. =head1 SEE ALSO The F file for an explanation of how to view exhaustive details on what changed. The F file for how to build Perl. The F file for general stuff. The F and F files for copyright information. =cut