summaryrefslogtreecommitdiff
path: root/pod/perl53710delta.pod
blob: 36f5c60c21300ecb4b4bbd52985637361d20e01c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
=encoding utf8

=head1 NAME

perl53710delta - what is new for perl v5.37.10

=head1 DESCRIPTION

This document describes differences between the 5.37.9 release and the 5.37.10
release.

If you are upgrading from an earlier release such as 5.37.8, first read
L<perl5379delta>, which describes differences between 5.37.8 and 5.37.9.

=head1 Core Enhancements

=head2 Some C<goto>s are now permitted in C<defer> and C<finally> blocks

Perl version 5.36.0 added C<defer> blocks and permitted the C<finally> keyword
to also add similar behaviour to C<try>/C<catch> syntax.  These did not permit
any C<goto> expression within the body, as it could have caused control flow
to jump out of the block.  Now, some C<goto> expressions are allowed, if they
have a constant target label, and that label is found within the block.

  use feature 'defer';

  defer {
    goto LABEL;
    print "This does not execute\n";
    LABEL: print "This does\n";
  }

=head2 New regexp variable ${^LAST_SUCCESSFUL_PATTERN}

This allows access to the last succesful pattern that matched in the current scope.
Many aspects of the regex engine refer to the "last successful pattern". The empty
pattern reuses it, and all of the magic regex vars relate to it. This allows
access to its pattern. The following code

    if (m/foo/ || m/bar/) {
        s//PQR/;
    }

can be rewritten as follows

    if (m/foo/ || m/bar/) {
        s/${^LAST_SUCCESSFUL_PATTERN}/PQR/;
    }

and it will do the exactly same thing.

=head2 Deprecation warnings now have specific subcategories

As of 5.37.10 all deprecation warnings will have their own specific
deprecation category which can be disabled individually. You can see a
list of all deprecated features in L<perldeprecation>, and in
L<warnings>. The following list is from L<warnings>:

         +- deprecated ----+
         |                 |
         |                 +- deprecated::apostrophe_as_package_separator
         |                 |
         |                 +- deprecated::delimiter_will_be_paired
         |                 |
         |                 +- deprecated::dot_in_inc
         |                 |
         |                 +- deprecated::goto_construct
         |                 |
         |                 +- deprecated::smartmatch
         |                 |
         |                 +- deprecated::unicode_property_name
         |                 |
         |                 +- deprecated::version_downgrade

It is still possible to disable all deprecation warnings in a single
statement with

    no warnings 'deprecated';

but as of 5.37.10 it is possible to have a finer grained control. As
has historically been the case these warnings are automatically
enabled with

    use warnings;

=head2 %{^HOOK} API introduced

For various reasons it can be difficult to create subroutine wrappers
for some of perls keywords. Any keyword which has an undefined
prototype simply cannot be wrapped with a subroutine, and some keywords
which perl permits to be wrapped are in practice very tricky to wrap.
For example C<require> is tricky to wrap, it is possible but doing so
changes the stack depth, and the standard methods of exporting assume
that they will be exporting to a package at certain stack depth up the
stack, and the wrapper will thus change where functions are exported to
unless implemented with a great deal of care. This can be very awkward
to deal with.

Accordingly we have introduced a new hash called C<%{^HOOK}> which is
intended to facilitate such cases. When a keyword supports any kind of
special hook then the hook will live in this new hash. Hooks in this
hash will be named after the function they are called by, followed by
two underbars and then the phase they are executed in, currently either
before or after the keyword is executed.

In this initial release we support two hooks C<require__before> and
C<require__after>. These are provided to make it easier to perform tasks
before and after a require statement.

See L<perlvar> for more details.

=head1 Modules and Pragmata

=head2 Updated Modules and Pragmata

=over 4

=item *

L<Benchmark> has been upgraded from version 1.23 to 1.24.

=item *

L<Class::Struct> has been upgraded from version 0.67 to 0.68.

=item *

L<Config::Perl::V> has been upgraded from version 0.35 to 0.36.

=item *

L<Data::Dumper> has been upgraded from version 2.187 to 2.188.

=item *

L<Digest::SHA> has been upgraded from version 6.03 to 6.04.

=item *

L<Env> has been upgraded from version 1.05 to 1.06.

=item *

L<feature> has been upgraded from version 1.80 to 1.81.

=item *

L<File::Spec> has been upgraded from version 3.88 to 3.89.

=item *

L<Net::Cmd> has been upgraded from version 3.14 to 3.15.

=item *

L<Math::Complex> has been upgraded from version 1.61 to 1.62.

=item *

L<Module::CoreList> has been upgraded from version 5.20230220 to 5.20230320.

=item *

L<overload> has been upgraded from version 1.36 to 1.37.

=item *

L<POSIX> has been upgraded from version 2.11 to 2.12.

=item *

L<Storable> has been upgraded from version 3.29 to 3.31.

=item *

L<Test::Simple> has been upgraded from version 1.302192 to 1.302194.

=item *

L<threads> has been upgraded from version 2.34 to 2.35.

=item *

L<threads::shared> has been upgraded from version 1.65 to 1.67.

=item *

L<Time::HiRes> has been upgraded from version 1.9772 to 1.9774.

=item *

L<warnings> has been upgraded from version 1.62 to 1.63.

=item *

L<XS::APItest> has been upgraded from version 1.30 to 1.32.

=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<https://github.com/Perl/perl5/issues/new/choose>.

Additionally, the following selected changes have been made:

=head3 F<pod/perldebguts.pod>

=over 4

=item *

Updates to regex internals documentation.

=back

=head3 F<pod/perldeprecation.pod>

=over 4

=item *

Added information about unscheduled deprecations and their categories.

=item *

Added category information for existing scheduled deprecations.

=item *

Added smartmatch and apostrophe as a package separator deprecation data.

=back

=head3 F<pod/perlexperiment.pod>

=over 4

=item *

Smartmatch has been moved from experimental status to deprecated status.
Unfortunately the experiment did not work out.

=back

=head3 F<pod/perlexperiment.pod>

=over 4

=item *

Documented new require hooks.

=back

=head3 F<pod/perlguts.pod>

=over 4

=item *

Documented new magic types C<PERL_MAGIC_destruct>, C<PERL_MAGIC_hook> and
C<PERL_MAGIC_hookelem>.

=item *

Documented several new or existing save stack macros: C<SAVERCPV()>,
C<SAVEGENERICSV()>, C<SAVEFREEPV()>, C<SAVEFREERCPV()>

=item *

Documented new mortalization callback macros: C<MORTALSVFUNC_X()>,
C<MORTALDESTRUCTOR_SV()>

=back

=head3 F<pod/perlop.pod>

=over 4

=item *

Document the behavior of matching the empty pattern better and specify
its relationship to the new C<${^LAST_SUCCESSFUL_PATTERN}> properly.

=back

=head3 F<pod/perlvar.pod>

=over 4

=item *

Added information on the new C<%{^HOOK}> interface, and the new
C<require__before> and C<require__after> hooks which it exposes.

=item *

Correct information on the regex variables C<${^PREMATCH}>, C<${^MATCH}>
and C<${^POSTMATCH}>, all of which were incorrectly documented due to an
oversight. Specifically they only work properly after a regex operation
that used the /p modifier to enable them.

=item *

Added information on the new regex variable C<${^LAST_SUCCESSFUL_PATTERN}>,
which represents the pattern of the last successful regex match in scope.

=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<perldiag>.

=head2 New Diagnostics

=head3 New Errors

=over 4

=item *

L<${^HOOK}{%s} may only be a CODE reference or undef|perldiag/"${^HOOK}{%s} may only be a CODE reference or undef">

=item *

L<Attempt to set unknown hook '%s' in %{^HOOK}|perldiag/"Attempt to set unknown hook '%s' in %{^HOOK}">

=item *

L<Missing or undefined argument to %s via %{^HOOK}{require__before}|perldiag/"Missing or undefined argument to %s via %{^HOOK}{require__before}">

=item *

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/">

=back

=head3 New Warnings

=over 4

=item *

L<Can't call destructor for 0x%p in global destruction|perldiag/"Can't call destructor for 0x%p in global destruction">

=back

=head2 Changes to Existing Diagnostics

=over 4

=item *

L<given is deprecated|perldiag/"given is deprecated"> replaces C<given is experimental>.

=item *

L<when is deprecated|perldiag/"when is deprecated"> replaces C<when is experimental>.

=item *

L<Smartmatch is deprecated|perldiag/"Smartmatch is deprecated"> replaces C<Smartmatch is experimental>.

=back

=head1 Testing

Tests were added and changed to reflect the other additions and
changes in this release.  Furthermore, these significant changes were
made:

=over 4

=item *

Added t/op/hook/ for testing C<%{^HOOK}> related functionality. Specifically
the F<t/op/hook/require.t> for testing the new require hooks.

=item *

Added F<t/op/deprecation.t> to test that our deprecation policies are being
followed properly.

=item *

Fixed bugs in F<t/harness> and F<t/TEST> that meant that tests in F<t/test_pl> and
F<t/class> were not being run during normal testing.

=back

=head2 Platform-Specific Notes

=over 4

=item Windows

=over 4

=item *

C<POSIX::dup2> no longer creates broken sockets. [L<GH #20920|https://github.com/Perl/perl5/issues/20920>]

=item *

Closing a busy pipe could cause Perl to hang. [L<GH #19963|https://github.com/Perl/perl5/issues/19963>]

=back

=back

=head1 Internal Changes

=over 4

=item *

Added C<SAVERCPV()> and C<SAVEFREERCPV()> for better support for working
with C<RCPV> (reference counted string/pointer value) structures which
currently are used in opcodes to share filename and warning bit data in
a memory efficient manner.

=item *

Added C<MORTALSVFUNC_SV()> and C<MORTALDESTRUCTOR_SV()> macros, which
make it possible to create a destructor which is fired at the end of
the current statement. This uses the C<PERL_MAGIC_destruct> magic to
use "free" magic to trigger an action when a variable is freed. The
action can be specified as a C function or as a Perl code reference.

=item *

Added the C<%{^HOOK}> api and related C<PERL_MAGIC_hook> and
C<PERL_MAGIC_hookelem> for providing ways to hook selected perl functions
which for one reason or another are problematic to wrap with a customized
subroutine.

=item *

Added support for C<${^HOOK}{require__before}> which can be used to
rewrite the filename that C<require> will try to load, and also to block
C<require> from loading a specific module, even via fully qualified
filename. The hook can also be used to perform "pre-require" and
"post-require" actions.

=item *

Added support for C<${^HOOK}{require__after}> which can be used to
track what modules have been required after the fact.

=item *

Regular expression opcodes (regops) now use a standardized structure
layout that uses unions to expose data in different format. This means
it should be much easier to extend or modify regops to use more memory.
This has been used to make a number of regops track how many parens
they contain.

=back

=head1 Selected Bug Fixes

=over 4

=item *

In the new experimental C<class> feature, attributes are no longer a syntax
error when using the unit class syntax.
[L<GH #20888|https://github.com/Perl/perl5/issues/20888>].

=item *

A number of bugs related to capture groups in quantified groups in regular
expression have been fixed, especially in alternations. For example in
a pattern like:

	"foobazfoobar" =~ /((foo)baz|foo(bar))+/

the regex variable C<$2> will not be "foo" as it once was, it will be undef.

=item *

Bugs with regex backreference operators that are inside of a capture
group have been fixed. For instance:

    "xa=xaaa" =~ /^(xa|=?\1a){2}\z/

will now correctly not match. [L<GH #10073|https://github.com/Perl/perl5/issues/10073>]

=item *

C<SSGROW()> and C<SSCHECK()> have been reworked to ensure that the requested
space is actually allocated. C<SSCHECK()> is now an alias for C<SSGROW()>.

=back

=head1 Acknowledgements

Perl 5.37.10 represents approximately 4 weeks of development since Perl
5.37.9 and contains approximately 23,000 lines of changes across 360 files
from 21 authors.

Excluding auto-generated files, documentation and release tools, there were
approximately 6,000 lines of changes to 220 .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.10:

Arne Johannessen, Craig A. Berry, Dan Jacobson, David Mitchell, Elvin
Aslanov, Graham Knop, James E Keenan, James Raspass, Jon Gentle, Karen
Etheridge, Karl Williamson, Leon Timmermans, Lukas Mai, Paul Evans, Philippe
Bruhat (BooK), Richard Leach, Steve Hay, Tomasz Konojacki, Tony Cook, Yves
Orton, Zefram.

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<AUTHORS> 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<https://github.com/Perl/perl5/issues>.  There may also be information at
L<http://www.perl.org/>, the Perl Home Page.

If you believe you have an unreported bug, please open an issue at
L<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
L<perlsec/SECURITY VULNERABILITY CONTACT INFORMATION>
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<perlthanks> program:

    perlthanks

This will send an email to the Perl 5 Porters list with your show of thanks.

=head1 SEE ALSO

The F<Changes> file for an explanation of how to view exhaustive details on
what changed.

The F<INSTALL> file for how to build Perl.

The F<README> file for general stuff.

The F<Artistic> and F<Copying> files for copyright information.

=cut