| 1 | =encoding utf8 |
| 2 | |
| 3 | =head1 NAME |
| 4 | |
| 5 | perldelta - what is new for perl v5.37.10 |
| 6 | |
| 7 | =head1 DESCRIPTION |
| 8 | |
| 9 | This document describes differences between the 5.37.9 release and the 5.37.10 |
| 10 | release. |
| 11 | |
| 12 | If you are upgrading from an earlier release such as 5.37.8, first read |
| 13 | L<perl5379delta>, which describes differences between 5.37.8 and 5.37.9. |
| 14 | |
| 15 | =head1 Core Enhancements |
| 16 | |
| 17 | =head2 Some C<goto>s are now permitted in C<defer> and C<finally> blocks |
| 18 | |
| 19 | Perl version 5.36.0 added C<defer> blocks and permitted the C<finally> keyword |
| 20 | to also add similar behaviour to C<try>/C<catch> syntax. These did not permit |
| 21 | any C<goto> expression within the body, as it could have caused control flow |
| 22 | to jump out of the block. Now, some C<goto> expressions are allowed, if they |
| 23 | have a constant target label, and that label is found within the block. |
| 24 | |
| 25 | use feature 'defer'; |
| 26 | |
| 27 | defer { |
| 28 | goto LABEL; |
| 29 | print "This does not execute\n"; |
| 30 | LABEL: print "This does\n"; |
| 31 | } |
| 32 | |
| 33 | =head2 New regexp variable ${^LAST_SUCCESSFUL_PATTERN} |
| 34 | |
| 35 | This allows access to the last succesful pattern that matched in the current scope. |
| 36 | Many aspects of the regex engine refer to the "last successful pattern". The empty |
| 37 | pattern reuses it, and all of the magic regex vars relate to it. This allows |
| 38 | access to its pattern. The following code |
| 39 | |
| 40 | if (m/foo/ || m/bar/) { |
| 41 | s//PQR/; |
| 42 | } |
| 43 | |
| 44 | can be rewritten as follows |
| 45 | |
| 46 | if (m/foo/ || m/bar/) { |
| 47 | s/${^LAST_SUCCESSFUL_PATTERN}/PQR/; |
| 48 | } |
| 49 | |
| 50 | and it will do the exactly same thing. |
| 51 | |
| 52 | =head2 Deprecation warnings now have specific subcategories |
| 53 | |
| 54 | As of 5.37.10 all deprecation warnings will have their own specific |
| 55 | deprecation category which can be disabled individually. You can see a |
| 56 | list of all deprecated features in L<perldeprecation>, and in |
| 57 | L<warnings>. The following list is from L<warnings>: |
| 58 | |
| 59 | +- deprecated ----+ |
| 60 | | | |
| 61 | | +- deprecated::apostrophe_as_package_separator |
| 62 | | | |
| 63 | | +- deprecated::delimiter_will_be_paired |
| 64 | | | |
| 65 | | +- deprecated::dot_in_inc |
| 66 | | | |
| 67 | | +- deprecated::goto_construct |
| 68 | | | |
| 69 | | +- deprecated::smartmatch |
| 70 | | | |
| 71 | | +- deprecated::unicode_property_name |
| 72 | | | |
| 73 | | +- deprecated::version_downgrade |
| 74 | |
| 75 | It is still possible to disable all deprecation warnings in a single |
| 76 | statement with |
| 77 | |
| 78 | no warnings 'deprecated'; |
| 79 | |
| 80 | but as of 5.37.10 it is possible to have a finer grained control. As |
| 81 | has historically been the case these warnings are automatically |
| 82 | enabled with |
| 83 | |
| 84 | use warnings; |
| 85 | |
| 86 | =head2 %{^HOOK} API introduced |
| 87 | |
| 88 | For various reasons it can be difficult to create subroutine wrappers |
| 89 | for some of perls keywords. Any keyword which has an undefined |
| 90 | prototype simply cannot be wrapped with a subroutine, and some keywords |
| 91 | which perl permits to be wrapped are in practice very tricky to wrap. |
| 92 | For example C<require> is tricky to wrap, it is possible but doing so |
| 93 | changes the stack depth, and the standard methods of exporting assume |
| 94 | that they will be exporting to a package at certain stack depth up the |
| 95 | stack, and the wrapper will thus change where functions are exported to |
| 96 | unless implemented with a great deal of care. This can be very awkward |
| 97 | to deal with. |
| 98 | |
| 99 | Accordingly we have introduced a new hash called C<%{^HOOK}> which is |
| 100 | intended to facilitate such cases. When a keyword supports any kind of |
| 101 | special hook then the hook will live in this new hash. Hooks in this |
| 102 | hash will be named after the function they are called by, followed by |
| 103 | two underbars and then the phase they are executed in, currently either |
| 104 | before or after the keyword is executed. |
| 105 | |
| 106 | In this initial release we support two hooks C<require__before> and |
| 107 | C<require__after>. These are provided to make it easier to perform tasks |
| 108 | before and after a require statement. |
| 109 | |
| 110 | See L<perlvar> for more details. |
| 111 | |
| 112 | =head1 Modules and Pragmata |
| 113 | |
| 114 | =head2 Updated Modules and Pragmata |
| 115 | |
| 116 | =over 4 |
| 117 | |
| 118 | =item * |
| 119 | |
| 120 | L<Benchmark> has been upgraded from version 1.23 to 1.24. |
| 121 | |
| 122 | =item * |
| 123 | |
| 124 | L<Class::Struct> has been upgraded from version 0.67 to 0.68. |
| 125 | |
| 126 | =item * |
| 127 | |
| 128 | L<Config::Perl::V> has been upgraded from version 0.35 to 0.36. |
| 129 | |
| 130 | =item * |
| 131 | |
| 132 | L<Data::Dumper> has been upgraded from version 2.187 to 2.188. |
| 133 | |
| 134 | =item * |
| 135 | |
| 136 | L<Digest::SHA> has been upgraded from version 6.03 to 6.04. |
| 137 | |
| 138 | =item * |
| 139 | |
| 140 | L<Env> has been upgraded from version 1.05 to 1.06. |
| 141 | |
| 142 | =item * |
| 143 | |
| 144 | L<feature> has been upgraded from version 1.80 to 1.81. |
| 145 | |
| 146 | =item * |
| 147 | |
| 148 | L<File::Spec> has been upgraded from version 3.88 to 3.89. |
| 149 | |
| 150 | =item * |
| 151 | |
| 152 | L<Net::Cmd> has been upgraded from version 3.14 to 3.15. |
| 153 | |
| 154 | =item * |
| 155 | |
| 156 | L<Math::Complex> has been upgraded from version 1.61 to 1.62. |
| 157 | |
| 158 | =item * |
| 159 | |
| 160 | L<Module::CoreList> has been upgraded from version 5.20230220 to 5.20230320. |
| 161 | |
| 162 | =item * |
| 163 | |
| 164 | L<overload> has been upgraded from version 1.36 to 1.37. |
| 165 | |
| 166 | =item * |
| 167 | |
| 168 | L<POSIX> has been upgraded from version 2.11 to 2.12. |
| 169 | |
| 170 | =item * |
| 171 | |
| 172 | L<Storable> has been upgraded from version 3.29 to 3.31. |
| 173 | |
| 174 | =item * |
| 175 | |
| 176 | L<Test::Simple> has been upgraded from version 1.302192 to 1.302194. |
| 177 | |
| 178 | =item * |
| 179 | |
| 180 | L<threads> has been upgraded from version 2.34 to 2.35. |
| 181 | |
| 182 | =item * |
| 183 | |
| 184 | L<threads::shared> has been upgraded from version 1.65 to 1.67. |
| 185 | |
| 186 | =item * |
| 187 | |
| 188 | L<Time::HiRes> has been upgraded from version 1.9772 to 1.9774. |
| 189 | |
| 190 | =item * |
| 191 | |
| 192 | L<warnings> has been upgraded from version 1.62 to 1.63. |
| 193 | |
| 194 | =item * |
| 195 | |
| 196 | L<XS::APItest> has been upgraded from version 1.30 to 1.32. |
| 197 | |
| 198 | =back |
| 199 | |
| 200 | =head1 Documentation |
| 201 | |
| 202 | =head2 Changes to Existing Documentation |
| 203 | |
| 204 | We have attempted to update the documentation to reflect the changes |
| 205 | listed in this document. If you find any we have missed, open an issue |
| 206 | at L<https://github.com/Perl/perl5/issues/new/choose>. |
| 207 | |
| 208 | Additionally, the following selected changes have been made: |
| 209 | |
| 210 | =head3 F<pod/perldebguts.pod> |
| 211 | |
| 212 | =over 4 |
| 213 | |
| 214 | =item * |
| 215 | |
| 216 | Updates to regex internals documentation. |
| 217 | |
| 218 | =back |
| 219 | |
| 220 | =head3 F<pod/perldeprecation.pod> |
| 221 | |
| 222 | =over 4 |
| 223 | |
| 224 | =item * |
| 225 | |
| 226 | Added information about unscheduled deprecations and their categories. |
| 227 | |
| 228 | =item * |
| 229 | |
| 230 | Added category information for existing scheduled deprecations. |
| 231 | |
| 232 | =item * |
| 233 | |
| 234 | Added smartmatch and apostrophe as a package separator deprecation data. |
| 235 | |
| 236 | =back |
| 237 | |
| 238 | =head3 F<pod/perlexperiment.pod> |
| 239 | |
| 240 | =over 4 |
| 241 | |
| 242 | =item * |
| 243 | |
| 244 | Smartmatch has been moved from experimental status to deprecated status. |
| 245 | Unfortunately the experiment did not work out. |
| 246 | |
| 247 | =back |
| 248 | |
| 249 | =head3 F<pod/perlexperiment.pod> |
| 250 | |
| 251 | =over 4 |
| 252 | |
| 253 | =item * |
| 254 | |
| 255 | Documented new require hooks. |
| 256 | |
| 257 | =back |
| 258 | |
| 259 | =head3 F<pod/perlguts.pod> |
| 260 | |
| 261 | =over 4 |
| 262 | |
| 263 | =item * |
| 264 | |
| 265 | Documented new magic types C<PERL_MAGIC_destruct>, C<PERL_MAGIC_hook> and |
| 266 | C<PERL_MAGIC_hookelem>. |
| 267 | |
| 268 | =item * |
| 269 | |
| 270 | Documented several new or existing save stack macros: C<SAVERCPV()>, |
| 271 | C<SAVEGENERICSV()>, C<SAVEFREEPV()>, C<SAVEFREERCPV()> |
| 272 | |
| 273 | =item * |
| 274 | |
| 275 | Documented new mortalization callback macros: C<MORTALSVFUNC_X()>, |
| 276 | C<MORTALDESTRUCTOR_SV()> |
| 277 | |
| 278 | =back |
| 279 | |
| 280 | =head3 F<pod/perlop.pod> |
| 281 | |
| 282 | =over 4 |
| 283 | |
| 284 | =item * |
| 285 | |
| 286 | Document the behavior of matching the empty pattern better and specify |
| 287 | its relationship to the new C<${^LAST_SUCCESSFUL_PATTERN}> properly. |
| 288 | |
| 289 | =back |
| 290 | |
| 291 | =head3 F<pod/perlvar.pod> |
| 292 | |
| 293 | =over 4 |
| 294 | |
| 295 | =item * |
| 296 | |
| 297 | Added information on the new C<%{^HOOK}> interface, and the new |
| 298 | C<require__before> and C<require__after> hooks which it exposes. |
| 299 | |
| 300 | =item * |
| 301 | |
| 302 | Correct information on the regex variables C<${^PREMATCH}>, C<${^MATCH}> |
| 303 | and C<${^POSTMATCH}>, all of which were incorrectly documented due to an |
| 304 | oversight. Specifically they only work properly after a regex operation |
| 305 | that used the /p modifier to enable them. |
| 306 | |
| 307 | =item * |
| 308 | |
| 309 | Added information on the new regex variable C<${^LAST_SUCCESSFUL_PATTERN}>, |
| 310 | which represents the pattern of the last successful regex match in scope. |
| 311 | |
| 312 | =back |
| 313 | |
| 314 | =head1 Diagnostics |
| 315 | |
| 316 | The following additions or changes have been made to diagnostic output, |
| 317 | including warnings and fatal error messages. For the complete list of |
| 318 | diagnostic messages, see L<perldiag>. |
| 319 | |
| 320 | =head2 New Diagnostics |
| 321 | |
| 322 | =head3 New Errors |
| 323 | |
| 324 | =over 4 |
| 325 | |
| 326 | =item * |
| 327 | |
| 328 | L<${^HOOK}{%s} may only be a CODE reference or undef|perldiag/"${^HOOK}{%s} may only be a CODE reference or undef"> |
| 329 | |
| 330 | =item * |
| 331 | |
| 332 | L<Attempt to set unknown hook '%s' in %{^HOOK}|perldiag/"Attempt to set unknown hook '%s' in %{^HOOK}"> |
| 333 | |
| 334 | =item * |
| 335 | |
| 336 | L<Missing or undefined argument to %s via %{^HOOK}{require__before}|perldiag/"Missing or undefined argument to %s via %{^HOOK}{require__before}"> |
| 337 | |
| 338 | =item * |
| 339 | |
| 340 | L<Too many capture groups (limit is %d) in regex mE<sol>%sE<sol>|perldiag/"Too many capture groups (limit is %d) in regex m/%s/"> |
| 341 | |
| 342 | =back |
| 343 | |
| 344 | =head3 New Warnings |
| 345 | |
| 346 | =over 4 |
| 347 | |
| 348 | =item * |
| 349 | |
| 350 | L<Can't call destructor for 0x%p in global destruction|perldiag/"Can't call destructor for 0x%p in global destruction"> |
| 351 | |
| 352 | =back |
| 353 | |
| 354 | =head2 Changes to Existing Diagnostics |
| 355 | |
| 356 | =over 4 |
| 357 | |
| 358 | =item * |
| 359 | |
| 360 | L<given is deprecated|perldiag/"given is deprecated"> replaces C<given is experimental>. |
| 361 | |
| 362 | =item * |
| 363 | |
| 364 | L<when is deprecated|perldiag/"when is deprecated"> replaces C<when is experimental>. |
| 365 | |
| 366 | =item * |
| 367 | |
| 368 | L<Smartmatch is deprecated|perldiag/"Smartmatch is deprecated"> replaces C<Smartmatch is experimental>. |
| 369 | |
| 370 | =back |
| 371 | |
| 372 | =head1 Testing |
| 373 | |
| 374 | Tests were added and changed to reflect the other additions and |
| 375 | changes in this release. Furthermore, these significant changes were |
| 376 | made: |
| 377 | |
| 378 | =over 4 |
| 379 | |
| 380 | =item * |
| 381 | |
| 382 | Added t/op/hook/ for testing C<%{^HOOK}> related functionality. Specifically |
| 383 | the F<t/op/hook/require.t> for testing the new require hooks. |
| 384 | |
| 385 | =item * |
| 386 | |
| 387 | Added F<t/op/deprecation.t> to test that our deprecation policies are being |
| 388 | followed properly. |
| 389 | |
| 390 | =item * |
| 391 | |
| 392 | Fixed bugs in F<t/harness> and F<t/TEST> that meant that tests in F<t/test_pl> and |
| 393 | F<t/class> were not being run during normal testing. |
| 394 | |
| 395 | =back |
| 396 | |
| 397 | =head2 Platform-Specific Notes |
| 398 | |
| 399 | =over 4 |
| 400 | |
| 401 | =item Windows |
| 402 | |
| 403 | =over 4 |
| 404 | |
| 405 | =item * |
| 406 | |
| 407 | C<POSIX::dup2> no longer creates broken sockets. [L<GH #20920|https://github.com/Perl/perl5/issues/20920>] |
| 408 | |
| 409 | =item * |
| 410 | |
| 411 | Closing a busy pipe could cause Perl to hang. [L<GH #19963|https://github.com/Perl/perl5/issues/19963>] |
| 412 | |
| 413 | =back |
| 414 | |
| 415 | =back |
| 416 | |
| 417 | =head1 Internal Changes |
| 418 | |
| 419 | =over 4 |
| 420 | |
| 421 | =item * |
| 422 | |
| 423 | Added C<SAVERCPV()> and C<SAVEFREERCPV()> for better support for working |
| 424 | with C<RCPV> (reference counted string/pointer value) structures which |
| 425 | currently are used in opcodes to share filename and warning bit data in |
| 426 | a memory efficient manner. |
| 427 | |
| 428 | =item * |
| 429 | |
| 430 | Added C<MORTALSVFUNC_SV()> and C<MORTALDESTRUCTOR_SV()> macros, which |
| 431 | make it possible to create a destructor which is fired at the end of |
| 432 | the current statement. This uses the C<PERL_MAGIC_destruct> magic to |
| 433 | use "free" magic to trigger an action when a variable is freed. The |
| 434 | action can be specified as a C function or as a Perl code reference. |
| 435 | |
| 436 | =item * |
| 437 | |
| 438 | Added the C<%{^HOOK}> api and related C<PERL_MAGIC_hook> and |
| 439 | C<PERL_MAGIC_hookelem> for providing ways to hook selected perl functions |
| 440 | which for one reason or another are problematic to wrap with a customized |
| 441 | subroutine. |
| 442 | |
| 443 | =item * |
| 444 | |
| 445 | Added support for C<${^HOOK}{require__before}> which can be used to |
| 446 | rewrite the filename that C<require> will try to load, and also to block |
| 447 | C<require> from loading a specific module, even via fully qualified |
| 448 | filename. The hook can also be used to perform "pre-require" and |
| 449 | "post-require" actions. |
| 450 | |
| 451 | =item * |
| 452 | |
| 453 | Added support for C<${^HOOK}{require__after}> which can be used to |
| 454 | track what modules have been required after the fact. |
| 455 | |
| 456 | =item * |
| 457 | |
| 458 | Regular expression opcodes (regops) now use a standardized structure |
| 459 | layout that uses unions to expose data in different format. This means |
| 460 | it should be much easier to extend or modify regops to use more memory. |
| 461 | This has been used to make a number of regops track how many parens |
| 462 | they contain. |
| 463 | |
| 464 | =back |
| 465 | |
| 466 | =head1 Selected Bug Fixes |
| 467 | |
| 468 | =over 4 |
| 469 | |
| 470 | =item * |
| 471 | |
| 472 | In the new experimental C<class> feature, attributes are no longer a syntax |
| 473 | error when using the unit class syntax. |
| 474 | [L<GH #20888|https://github.com/Perl/perl5/issues/20888>]. |
| 475 | |
| 476 | =item * |
| 477 | |
| 478 | A number of bugs related to capture groups in quantified groups in regular |
| 479 | expression have been fixed, especially in alternations. For example in |
| 480 | a pattern like: |
| 481 | |
| 482 | "foobazfoobar" =~ /((foo)baz|foo(bar))+/ |
| 483 | |
| 484 | the regex variable C<$2> will not be "foo" as it once was, it will be undef. |
| 485 | |
| 486 | =item * |
| 487 | |
| 488 | Bugs with regex backreference operators that are inside of a capture |
| 489 | group have been fixed. For instance: |
| 490 | |
| 491 | "xa=xaaa" =~ /^(xa|=?\1a){2}\z/ |
| 492 | |
| 493 | will now correctly not match. [L<GH #10073|https://github.com/Perl/perl5/issues/10073>] |
| 494 | |
| 495 | =item * |
| 496 | |
| 497 | C<SSGROW()> and C<SSCHECK()> have been reworked to ensure that the requested |
| 498 | space is actually allocated. C<SSCHECK()> is now an alias for C<SSGROW()>. |
| 499 | |
| 500 | =back |
| 501 | |
| 502 | =head1 Acknowledgements |
| 503 | |
| 504 | Perl 5.37.10 represents approximately 4 weeks of development since Perl |
| 505 | 5.37.9 and contains approximately 23,000 lines of changes across 360 files |
| 506 | from 21 authors. |
| 507 | |
| 508 | Excluding auto-generated files, documentation and release tools, there were |
| 509 | approximately 6,000 lines of changes to 220 .pm, .t, .c and .h files. |
| 510 | |
| 511 | Perl continues to flourish into its fourth decade thanks to a vibrant |
| 512 | community of users and developers. The following people are known to have |
| 513 | contributed the improvements that became Perl 5.37.10: |
| 514 | |
| 515 | Arne Johannessen, Craig A. Berry, Dan Jacobson, David Mitchell, Elvin |
| 516 | Aslanov, Graham Knop, James E Keenan, James Raspass, Jon Gentle, Karen |
| 517 | Etheridge, Karl Williamson, Leon Timmermans, Lukas Mai, Paul Evans, Philippe |
| 518 | Bruhat (BooK), Richard Leach, Steve Hay, Tomasz Konojacki, Tony Cook, Yves |
| 519 | Orton, Zefram. |
| 520 | |
| 521 | The list above is almost certainly incomplete as it is automatically |
| 522 | generated from version control history. In particular, it does not include |
| 523 | the names of the (very much appreciated) contributors who reported issues to |
| 524 | the Perl bug tracker. |
| 525 | |
| 526 | Many of the changes included in this version originated in the CPAN modules |
| 527 | included in Perl's core. We're grateful to the entire CPAN community for |
| 528 | helping Perl to flourish. |
| 529 | |
| 530 | For a more complete list of all of Perl's historical contributors, please |
| 531 | see the F<AUTHORS> file in the Perl source distribution. |
| 532 | |
| 533 | =head1 Reporting Bugs |
| 534 | |
| 535 | If you find what you think is a bug, you might check the perl bug database |
| 536 | at L<https://github.com/Perl/perl5/issues>. There may also be information at |
| 537 | L<http://www.perl.org/>, the Perl Home Page. |
| 538 | |
| 539 | If you believe you have an unreported bug, please open an issue at |
| 540 | L<https://github.com/Perl/perl5/issues>. Be sure to trim your bug down to a |
| 541 | tiny but sufficient test case. |
| 542 | |
| 543 | If the bug you are reporting has security implications which make it |
| 544 | inappropriate to send to a public issue tracker, then see |
| 545 | L<perlsec/SECURITY VULNERABILITY CONTACT INFORMATION> |
| 546 | for details of how to report the issue. |
| 547 | |
| 548 | =head1 Give Thanks |
| 549 | |
| 550 | If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, |
| 551 | you can do so by running the C<perlthanks> program: |
| 552 | |
| 553 | perlthanks |
| 554 | |
| 555 | This will send an email to the Perl 5 Porters list with your show of thanks. |
| 556 | |
| 557 | =head1 SEE ALSO |
| 558 | |
| 559 | The F<Changes> file for an explanation of how to view exhaustive details on |
| 560 | what changed. |
| 561 | |
| 562 | The F<INSTALL> file for how to build Perl. |
| 563 | |
| 564 | The F<README> file for general stuff. |
| 565 | |
| 566 | The F<Artistic> and F<Copying> files for copyright information. |
| 567 | |
| 568 | =cut |