=encoding utf8 =head1 NAME perldelta - what is new for perl v5.37.9 =head1 DESCRIPTION This document describes differences between the 5.37.8 release and the 5.37.9 release. If you are upgrading from an earlier release such as 5.37.7, first read L, which describes differences between 5.37.7 and 5.37.8. =head1 Core Enhancements =head2 New C Feature A new B syntax is now available for defining object classes, where per-instance data is stored in "field" variables that behave like lexicals. use feature 'class'; class Point { field $x; field $y; method zero { $x = $y = 0; } } This is described in more detail in L. Notes on the internals of its implementation and other related details can be found in L. This remains a new and experimental feature, and is very much still under development. It will be the subject of much further addition, refinement and alteration in future releases. As it is experimental, it yields warnings in the C category. These can be silenced by a C statement. use feature 'class'; no warnings 'experimental::class'; =head2 REG_INF has been raised from 65,536 to 2,147,483,647 Many regex quantifiers used to be limited to U16_MAX in the past, but are now limited to I32_MAX, thus it is now possible to write /(?:word){1000000}/ for example. Note that doing so may cause the regex engine to run longer and use more memory. =head2 New API functions optimize_optree and finalize_optree There are two new API functions for operating on optree fragments, ensuring you can invoke the required parts of the optree-generation process that might otherwise not get invoked (e.g. when creating a custom LOGOP). To get access to these functions, you first need to set a C<#define> to opt-in to using these functions. #define PERL_USE_VOLATILE_API These functions are closely tied to the internals of how the interpreter works, and could be altered or removed at any time if other internal changes make that necessary. =head1 Incompatible Changes =head2 (**{ ... }) removed from the regex engine. This feature was released as part of 5.37.8, after some use and discussion it was seen as more problematic than understood at first and has been removed in 5.37.9. It was only ever present in a single development release and has never been released as part of a production perl, thus no deprecation cycle has been performed. =head1 Deprecations =head2 Use of C<'> as a package name separator is deprecated Using C<'> as package separator in a variable named in a double-quoted string has warned since 5.28. It is now deprecated in both string interpolation and non-interpolated contexts, and will be removed in Perl 5.40. =head1 Performance Enhancements =over 4 =item * Temporary ("mortal") copies are no longer created during context exit for internal static SVs that are in no danger of being prematurely freed. [L|https://github.com/Perl/perl5/issues/20800] =back =head1 Modules and Pragmata =head2 Updated Modules and Pragmata =over 4 =item * L has been upgraded from version 2.34 to 2.36. =item * L has been upgraded from version 1.87 to 1.88. =item * L has been upgraded from version 2.201 to 2.204. =item * L has been upgraded from version 2.202 to 2.204. =item * L has been upgraded from version 1.32 to 1.33. =item * L has been upgraded from version 3.69 to 3.70. =item * L has been upgraded from version 0.030 to 0.031. =item * L has been upgraded from version 1.79 to 1.80. =item * L has been upgraded from version 1.42 to 1.43. =item * L has been upgraded from version 2.201 to 2.204. =item * L has been upgraded from version 1.6 to 1.61. =item * L has been upgraded from version 1.15 to 1.16. =item * L has been upgraded from version 5.20230120 to 5.20230220. =item * L has been upgraded from version 1.26 to 1.28. =item * L has been upgraded from version 1.63 to 1.64. =item * L has been upgraded from version 0.239 to 0.241. =item * L has been upgraded from version 1.17 to 1.18. =item * L has been upgraded from version 1.302191 to 1.302192. =item * L has been upgraded from version 1.06 to 1.07. =item * L has been upgraded from version 1.14 to 1.15. =item * L has been upgraded from version 1.61 to 1.62. =back =head1 Documentation =head2 New Documentation =head3 L Describes the new C feature. =head3 L Describes the internals of the new C feature. =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. Additionally, the following selected changes have been made: =head3 L =over 4 =item * Some wording improvements have been made for the C, C, C and C functions, as well as additional examples added. =back =head3 L =over 4 =item * Added a section on "Scoping Rules of Regex Variables", and other wording improvements made throughout. =back =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 Errors =over 4 =item * L (F) You are attempting to call C with a package name that is a new-style C. This is not necessary, as instances created by the constructor are already in the correct class. Instances cannot be created by other means, such as C. =item * L (F) An attempt was made to apply a parameter name to a field, when the name is already being used by another field in the same class, or one of its parent classes. This would cause a name clash so is not allowed. =item * L (F) An attempt was made to create a class out of a package that already has an C<@ISA> array, and the array is not empty. This is not permitted, as it would lead to a class with inconsistent inheritance. =item * L (F) You tried to directly call a C subroutine of one class by passing in a value that is an instance of a different class. This is not permitted, as the method would not have access to the correct instance fields. =item * L (F) You tried to directly call a C subroutine of a class by passing in a value that is not an instance of that class. This is not permitted, as the method would not then have access to its instance fields. =item * L (F) You attempted to use one of the keywords that only makes sense inside a C definition, at a location that is not inside such a class. =item * L (F) You tried to begin a C definition for a class that already exists. A class may only have one definition block. =item * L (F) You attempted to call C on a value that already refers to a real object instance. =item * L (F) On Cygwin, you called a path conversion function with an empty path. Only non-empty paths are legal. =item * L (F) You attempted to specify a second superclass for a C by using the C<:isa> attribute, when one is already specified. Unlike classes whose instances are created with C, classes created via the C keyword cannot have more than one superclass. =item * L (F) You specified an attribute for a class that would require a value to be passed in parentheses, but did not provide one. Remember that whitespace is B permitted between the attribute name and its value; you must write this as class Example::Class :attr(VALUE) ... =item * L (F) When creating a subclass using the C C<:isa> attribute, the named superclass must also be a real class created using the C keyword. =item * L (F) A field may have at most one application of the C<:param> attribute to assign a parameter name to it; once applied a second one is not allowed. =item * L (F) You specified an attribute for a field that would require a value to be passed in parentheses, but did not provide one. Remember that whitespace is B permitted between the attribute name and its value; you must write this as field $var :attr(VALUE) ... =item * L (F) An attempt was made to access a field variable of a class from code that does not appear inside the body of a C subroutine. This is not permitted, as only methods will have access to the fields of an instance. =item * L (F) An attempt was made to access a field variable of a class, from a method of another class nested inside the one that actually defined it. This is not permitted, as only methods defined by a given class are permitted to access fields of that class. =item * L (F) You tried to apply the C<:param> attribute to an array or hash field. Currently this is not permitted. =item * L (F) You called the constructor for a class that has a required named parameter, but did not pass that parameter at all. =item * L (F) You tried to specify something other than a single class name with an optional trailing version number as the value for a C C<:isa> attribute. This confused the parser. =item * L (F) You attempted to add a named attribute to a C definition, but perl does not recognise the name of the requested attribute. =item * L (F) You attempted to add a named attribute to a C definition, but perl does not recognise the name of the requested attribute. =back =head3 New Warnings =over 4 =item * L (S experimental::class) This warning is emitted if you use the C keyword of C. This keyword is currently experimental and its behaviour may change in future releases of Perl. =item * L (S experimental::class) This warning is emitted if you use the C keyword of C. This keyword is currently experimental and its behaviour may change in future releases of Perl. =item * L (W redefine) You redefined a method. To suppress this warning, say { no warnings 'redefine'; *name = method { ... }; } =item * L (W misc) You specified an odd number of elements to initialise a hash field of an object. Hashes are initialised from a list of key/value pairs so there must be a corresponding value to every key. The final missing value will be filled in with undef instead. =item * L (W deprecated, syntax) You used the old package separator "'" in a variable, subroutine or package name. Support for the old package separator will be removed in Perl 5.40. =item * L (S experimental::class) This warning is emitted if you use the C keyword of C. This keyword is currently experimental and its behaviour may change in future releases of Perl. =item * L (S experimental::class) This warning is emitted if you use the C keyword of C. This keyword is currently experimental and its behaviour may change in future releases of Perl. =back =head2 Changes to Existing Diagnostics =over 4 =item * L This diagnostic is now also part of the C category. =back =head1 Configuration and Compilation =over 4 =item * C now properly handles quoted elements outputted from gcc. [L] =item * C probed for the return type of malloc() and free() by testing whether declarations for those functions produced a function type mismatch with the implementation. On Solaris, with a C++ compiler, this check always failed, since Solaris instead imports malloc() and free() from C with C for C++ builds. Since the return types of malloc() and free() are well defined by the C standard, skip probing for them. C command-line arguments and hints can still override these type in the unlikely case that is needed. [L] =back =head1 Testing Tests were added and changed to reflect the other additions and changes in this release. =head1 Internal Changes =over 4 =item * The underlying C function implementing the long-deprecated L|perlapi/GIMME> macro has been marked as deprecated, so that use of the macro emits a compile-time warning. C has been documented as deprecated in favour of L|perlapi/GIMME_V> since Perl v5.6.0, but had not previously issued a warning. =item * The API function L is now more efficient. =back =head1 Selected Bug Fixes =over 4 =item * Writing to a magic variables associated with the selected output handle, C<$^>, C<$~>, C<$=>, C<$-> and C<$%>, no longer crashes perl if the IO object has been cleared from the selected output handle. [L] =item * Redefining a C list constant with C now properly warns. This changes the behaviour of C but is a core change, not a change to F. [L] =item * Redefining a C list constant with an empty prototype constant sub would result in an assertion failure. [L] =item * Fixed a regression where the C method for objects in C<@INC> would not be resolved by C, while it was in 5.36. The C method for objects in C<@INC> cannot be resolved by C as C would have been resolved first. [L] =item * C<$SIG{__DIE__}> will now be called from eval when the code dies during compilation regardless of how it dies. This means that code expecting to be able to upgrade C<$@> into an object will be called consistently. In earlier versions of perl C<$SIG{__DIE__}> would not be called for certain compilation errors, for instance undeclared variables. For other errors it might be called if there were more than a certain number of errors, but not if there were less. Now you can expect that it will be called in every case. =item * Compilation of code with errors used to inconsistently stop depending on the count and type of errors encountered. The intent was that after 10 errors compilation would halt, but bugs in this logic meant that certain types of error would be counted, but would not trigger the threshold check to stop compilation. Other errors would. With this release after at most 10 errors compilation will terminate, regardless of what type of error they were. Note that you can change the maximum count by defining C to be something else during the configuration process. For instance ./Configure ... -Accflags='-DPERL_STOP_PARSING_AFTER_N_ERRORS=100' would allow up to 100 errors. =item * The API function L now prints a non-dot decimal point if the perl code it ultimately is called from is in the scope of C and the locale in effect calls for that. =back =head1 Acknowledgements Perl 5.37.9 represents approximately 4 weeks of development since Perl 5.37.8 and contains approximately 24,000 lines of changes across 360 files from 32 authors. Excluding auto-generated files, documentation and release tools, there were approximately 8,400 lines of changes to 270 .pm, .t, .c and .h files. Perl continues to flourish into its fourth decade thanks to a vibrant community of users and developers. The following people are known to have contributed the improvements that became Perl 5.37.9: Alexander Nikolov, Alex Davies, Andrew Fresh, Aristotle Pagaltzis, Bartosz Jarzyna, Branislav Zahradník, Chad Granum, Craig A. Berry, Dagfinn Ilmari Mannsåker, Dan Jacobson, Elvin Aslanov, Håkon Hægland, Hugo van der Sanden, James E Keenan, Joe McMahon, Jonathan Stowe, Karen Etheridge, Karl Williamson, Kurt Fitzner, Leon Timmermans, Max Maischein, Nicholas Clark, Nicolas R, Paul Evans, Paul Marquess, Renee Baecker, Richard Leach, Scott Baker, Todd Rinaldo, Tomasz Konojacki, Tony Cook, Yves Orton. The list above is almost certainly incomplete as it is automatically generated from version control history. In particular, it does not include the names of the (very much appreciated) contributors who reported issues to the Perl bug tracker. Many of the changes included in this version originated in the CPAN modules included in Perl's core. We're grateful to the entire CPAN community for helping Perl to flourish. For a more complete list of all of Perl's historical contributors, please see the 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