xref: /openbsd-src/gnu/usr.bin/perl/pod/perl5360delta.pod (revision e068048151d29f2562a32185e21a8ba885482260)
1=encoding utf8
2
3=head1 NAME
4
5perl5360delta - what is new for perl v5.36.0
6
7=head1 DESCRIPTION
8
9This document describes differences between the 5.34.0 release and the 5.36.0
10release.
11
12=head1 Core Enhancements
13
14=head2 C<use v5.36>
15
16As always, C<use v5.36> turns on the feature bundle for that version of Perl.
17
18The 5.36 bundle enables the C<signatures> feature.  Introduced in Perl version
195.20.0, and modified several times since, the subroutine signatures feature is
20now no longer considered experimental. It is now considered a stable language
21feature and no longer prints a warning.
22
23    use v5.36;
24
25    sub add ($x, $y) {
26      return $x + $y;
27    }
28
29Despite this, certain elements of signatured subroutines remain experimental;
30see below.
31
32The 5.36 bundle enables the C<isa> feature.  Introduced in Perl version 5.32.0,
33this operator has remained unchanged since then. The operator is now considered
34a stable language feature.  For more detail see L<perlop/Class Instance
35Operator>.
36
37The 5.36 bundle also I<disables> the features C<indirect>, and
38C<multidimensional>.  These will forbid, respectively: the use of "indirect"
39method calls (like C<$x = new Class;>); the use of a list expression as a hash
40key to simulate sparse multidimensional arrays.  The specifics of these changes
41can be found in L<feature>, but the short version is: this is a bit like having
42more C<use strict> turned on, disabling features that cause more trouble than
43they're worth.
44
45Furthermore, C<use v5.36> will also enable warnings as if you'd written C<use
46warnings>.
47
48Finally, with this release, the experimental C<switch> feature, present in
49every feature bundle since they were introduced in v5.10, has been removed from
50the v5.36 bundle.  If you want to use it (against our advice), you'll have to
51enable it explicitly.
52
53=head2 -g command-line flag
54
55A new command-line flag, -g, is available. It is a simpler alias for -0777.
56
57For more information, see L<perlrun/-g>.
58
59=head2 Unicode 14.0 is supported
60
61See L<https://www.unicode.org/versions/Unicode14.0.0/> for details.
62
63=head2 regex sets are no longer considered experimental
64
65Prior to this release, the regex sets feature (officially named
66"Extended Bracketed Character Classes") was considered experimental.
67Introduced in Perl version 5.18.0, and modified several times since,
68this is now considered a stable language feature and its use no longer
69prints a warning.  See L<perlrecharclass/Extended Bracketed Character
70Classes>.
71
72=head2 Variable length lookbehind is mostly no longer considered experimental
73
74Prior to this release, any form of variable length lookbehind was
75considered experimental. With this release the experimental status has
76been reduced to cover only lookbehind that contains capturing parenthesis.
77This is because it is not clear if
78
79    "aaz"=~/(?=z)(?<=(a|aa))/
80
81should match and leave $1 equaling "a" or "aa". Currently it will match
82the longest possible alternative, "aa". While we are confident that the overall
83construct will now match only when it should, we are not confident that we
84will keep the current "longest match" behavior.
85
86=head2 SIGFPE no longer deferred
87
88Floating-point exceptions are now delivered immediately, in the same way
89as other "fault"-like signals such as SIGSEGV. This means one has at
90least a chance to catch such a signal with a C<$SIG{FPE}> handler, e.g.
91so that C<die> can report the line in perl that triggered it.
92
93=head2 Stable boolean tracking
94
95The "true" and "false" boolean values, often accessed by constructions like
96C<!!0> and C<!!1>, as well as being returned from many core functions and
97operators, now remember their boolean nature even through assignment into
98variables. The new function C<is_bool()> in L<builtin> can check whether
99a value has boolean nature.
100
101This is likely to be useful when interoperating with other languages or
102data-type serialisation, among other places.
103
104=head2 iterating over multiple values at a time (experimental)
105
106You can now iterate over multiple values at a time by specifying a list of
107lexicals within parentheses. For example,
108
109    for my ($key, $value) (%hash) { ... }
110    for my ($left, $right, $gripping) (@moties) { ... }
111
112Prior to perl v5.36, attempting to specify a list after C<for my> was a syntax
113error.
114
115This feature is currently experimental and will cause a warning of category
116C<experimental::for_list>.  For more detail see L<perlsyn/Compound Statements>.
117See also L</builtin::indexed> in this document, which is a handy companion to
118n-at-a-time foreach.
119
120=head2 builtin functions (experimental)
121
122A new core module L<builtin> has been added, which provides documentation for
123new always-present functions that are built into the interpreter.
124
125    say "Reference type of arrays is ", builtin::reftype([]);
126
127It also provides a lexical import mechanism for providing short name versions
128of these functions.
129
130    use builtin 'reftype';
131    say "Reference type of arrays is ", reftype([]);
132
133This builtin function mechanism and the functions it provides are all
134currently B<experimental>.  We expect that C<builtin> itself will cease to be
135experimental in the near future, but that individual functions in it may become
136stable on an ongoing basis.  Other functions will be added to C<builtin> over
137time.
138
139For details, see L<builtin>, but here's a summary of builtin functions in
140v5.36:
141
142=over 4
143
144=item builtin::trim
145
146This function treats its argument as a string, returning the result of removing
147all white space at its beginning and ending.
148
149=item builtin::indexed
150
151This function returns a list twice as big as its argument list, where each item
152is preceded by its index within that list. This is primarily useful for using
153the new C<foreach> syntax with multiple iterator variables to iterate over an
154array or list, while also tracking the index of each item:
155
156    use builtin 'indexed';
157
158    foreach my ($index, $val) (indexed @array) {
159        ...
160    }
161
162=item builtin::true, builtin::false, builtin::is_bool
163
164C<true> and C<false> return boolean true and false values.  Perl is still perl,
165and doesn't have strict typing of booleans, but these values will be known to
166have been created as booleans.  C<is_bool> will tell you whether a value was
167known to have been created as a boolean.
168
169=item builtin::weaken, builtin::unweaken, builtin::is_weak
170
171These functions will, respectively: weaken a reference; strengthen a reference;
172and return whether a reference is weak.  (A weak reference is not counted for
173garbage collection purposes.  See L<perlref>.)  These can take the place of
174some similar routines in L<Scalar::Util>.
175
176=item builtin::blessed, builtin::refaddr, builtin::reftype
177
178These functions provide more data about references (or non-references,
179actually!) and can take the place of similar routines found in L<Scalar::Util>.
180
181=item builtin::ceil, builtin::floor
182
183C<ceil> returns the smallest integer greater than or equal to its argument.
184C<floor> returns the largest integer less than or equal to its argument.  These
185can take the place of similar routines found in L<POSIX>.
186
187=back
188
189=head2 C<defer> blocks (experimental)
190
191This release adds support for C<defer> blocks, which are blocks of code
192prefixed by the C<defer> modifier. They provide a section of code which runs
193at a later time, during scope exit.
194
195In brief, when a C<defer> block is reached at runtime, its body is set aside to
196be run when the enclosing scope is exited.  It is unlike a UNITCHECK (among
197other reasons) in that if the block I<containing> the C<defer> block is exited
198before the block is reached, it will not be run.
199
200C<defer> blocks can be used to take the place of "scope guard" objects where an
201object is passed a code block to be run by its destructor.
202
203For more information, see L<perlsyn/"defer blocks">.
204
205=head2 try/catch can now have a C<finally> block (experimental)
206
207The experimental C<try>/C<catch> syntax has been extended to support an
208optional third block introduced by the C<finally> keyword.
209
210    try {
211        attempt();
212        print "Success\n";
213    }
214    catch ($e) {
215        print "Failure\n";
216    }
217    finally {
218        print "This happens regardless\n";
219    }
220
221This provides code which runs at the end of the C<try>/C<catch> construct,
222even if aborted by an exception or control-flow keyword. They are similar
223to C<defer> blocks.
224
225For more information, see L<perlsyn/"Try Catch Exception Handling">.
226
227=head2 non-ASCII delimiters for quote-like operators (experimental)
228
229Perl traditionally has allowed just four pairs of string/pattern
230delimiters: S<C<( )>> S<C<{ }>> S<C<[ ]>> and S<C<< < > >>>, all in the
231ASCII range.  Unicode has hundreds more possibilities, and using this
232feature enables many of them.  When enabled, you can say S<C<qr« »>> for
233example, or S<C<use utf8; q��string��>>.  See L<feature/The
234'extra_paired_delimiters' feature> for details.
235
236=head2 @_ is now experimental within signatured subs
237
238Even though subroutine signatures are now stable, use of the legacy arguments
239array (C<@_>) with a subroutine that has a signature I<remains> experimental,
240with its own warning category.  Silencing the C<experimental::signatures>
241warning category is not sufficient to dismiss this.  The new warning is emitted
242with the category name C<experimental::args_array_with_signatures>.
243
244Any subroutine that has a signature and tries to make use of the defaults
245argument array or an element thereof (C<@_> or C<$_[INDEX]>), either
246explicitly or implicitly (such as C<shift> or C<pop> with no argument) will
247provoke a warning at compile-time:
248
249    use v5.36;
250
251    sub f ($x, $y = 123) {
252      say "The first argument is $_[0]";
253    }
254
255Z<>
256
257    Use of @_ in array element with signatured subroutine is experimental
258    at file.pl line 4.
259
260The behaviour of code which attempts to do this is no longer specified, and
261may be subject to change in a future version.
262
263=head1 Incompatible Changes
264
265=head2 A physically empty sort is now a compile-time error
266
267    @a = sort @empty; # unaffected
268    @a = sort;        # now a compile-time error
269    @a = sort ();     # also a compile-time error
270
271A bare sort used to be a weird way to create an empty list; now it croaks
272at compile time. This change is intended to free up some of the syntax space
273for possible future enhancements to C<sort>.
274
275=head1 Deprecations
276
277=head2 C<use VERSION> (where VERSION is below v5.11) after C<use v5.11> is deprecated
278
279When in the scope of C<use v5.11> or later, a C<use vX> line where I<X> is
280lower than v5.11 will now issue a warning:
281
282    Downgrading a use VERSION declaration to below v5.11 is deprecated
283
284For example:
285
286    use v5.14;
287    say "The say statement is permitted";
288    use v5.8;                               # This will print a warning
289    print "We must use print\n";
290
291This is because the Perl team plans to change the behavior in this case.  Since
292Perl v5.12 (and parts of v5.11), strict is enabled I<unless it had previously
293been disabled>.  In other words:
294
295    no strict;
296    use v5.12;  # will not enable strict, because "no strict" preceded it
297    $x = 1;     # permitted, despite no "my" declaration
298
299In the future, this behavior will be eliminated and C<use VERSION> will
300I<always> enable strict for versions v5.12 and later.
301
302Code which wishes to mix versions in this manner should use lexical scoping
303with block syntax to ensure that the differently versioned regions remain
304lexically isolated.
305
306    {
307        use v5.14;
308        say "The say statement is permitted";
309    }
310
311    {
312        use v5.8;                           # No warning is emitted
313        print "We must use print\n";
314    }
315
316Of course, this is probably not something you ever need to do!  If the first
317block compiles, it means you're using perl v5.14.0 or later.
318
319=head1 Performance Enhancements
320
321=over 4
322
323=item *
324
325We now probe for compiler support for C11 thread local storage, and where
326available use this for "implicit context" for XS extensions making API calls for
327a threaded Perl build.  This requires fewer function calls at the C level than
328POSIX thread specific storage. We continue to use the pthreads approach if
329the C11 approach is not available.
330
331F<Configure> run with the defaults will build an unthreaded Perl (which is
332slightly faster), but most operating systems ship a threaded Perl.
333
334=item *
335
336Perl can now be configured to no longer allocate keys for large hashes
337from the shared string table.
338
339The same internal datatype (C<PVHV>) is used for all of
340
341=over 4
342
343=item *
344
345Symbol tables
346
347=item *
348
349Objects (by default)
350
351=item *
352
353Associative arrays
354
355=back
356
357The shared string table was originally added to improve performance for blessed
358hashes used as objects, because every object instance has the same keys, so it
359is an optimisation to share memory between them. It also makes sense for symbol
360tables, where derived classes will have the same keys (typically method names),
361and the OP trees built for method calls can also share memory. The shared
362string table behaves roughly like a cache for hash keys.
363
364But for hashes actually used as associative arrays - mapping keys to values -
365typically the keys are not re-used in other hashes. For example, "seen" hashes
366are keyed by object IDs (or addresses), and logically these keys won't repeat
367in other hashes.
368
369Storing these "used just once" keys in the shared string table increases CPU
370and RAM use for no gain. For such keys the shared string table behaves as a
371cache with a 0% hit rate. Storing all the keys there increases the total size
372of the shared string table, as well as increasing the number of times it is
373resized as it grows. B<Worse> - in any environment that has "copy on write"
374memory for child process (such as a pre-forking server), the memory pages used
375for the shared string table rapidly need to be copied as the child process
376manipulates hashes. Hence if most of the shared string table is such that keys
377are used only in one place, there is no benefit from re-use within the perl
378interpreter, but a high cost due to more pages for the OS to copy.
379
380The perl interpreter can now be Configured to disable shared hash keys
381for "large" hashes (that are neither objects nor symbol tables).  To do
382so, add C<-Accflags='-DPERL_USE_UNSHARED_KEYS_IN_LARGE_HASHES'> to
383your F<Configure> options.  "Large" is a heuristic -- currently the
384heuristic is that sharing is disabled when adding a key to a hash
385triggers allocation of more storage, and the hash has more than 42 keys.
386
387This B<might> cause slightly increased memory usage for programs that create
388(unblessed) data structures that contain multiple large hashes that share the
389same keys. But generally our testing suggests that for the specific cases
390described it is a win, and other code is unaffected.
391
392=item *
393
394In certain scenarios, creation of new scalars is now noticeably faster.
395
396For example, the following code is now executing ~30% faster:
397
398    $str = "A" x 64;
399    for (0..1_000_000) {
400        @svs = split //, $str
401    }
402
403(You can read more about this one in L<[perl
404#19414]|https://github.com/Perl/perl5/pull/19414>.)
405
406=back
407
408=head1 Modules and Pragmata
409
410=head2 Updated Modules and Pragmata
411
412=over 4
413
414=item *
415
416L<Archive::Tar> has been upgraded from version 2.38 to 2.40.
417
418=item *
419
420L<Attribute::Handlers> has been upgraded from version 1.01 to 1.02.
421
422=item *
423
424L<attributes> has been upgraded from version 0.33 to 0.34.
425
426=item *
427
428L<B> has been upgraded from version 1.82 to 1.83.
429
430=item *
431
432L<B::Concise> has been upgraded from version 1.004 to 1.006.
433
434=item *
435
436L<B::Deparse> has been upgraded from version 1.56 to 1.64.
437
438=item *
439
440L<bignum> has been upgraded from version 0.51 to 0.65.
441
442=item *
443
444L<charnames> has been upgraded from version 1.48 to 1.50.
445
446=item *
447
448L<Compress::Raw::Bzip2> has been upgraded from version 2.101 to 2.103.
449
450=item *
451
452L<Compress::Raw::Zlib> has been upgraded from version 2.101 to 2.105.
453
454=item *
455
456L<CPAN> has been upgraded from version 2.28 to 2.33.
457
458=item *
459
460L<Data::Dumper> has been upgraded from version 2.179 to 2.184.
461
462=item *
463
464L<DB_File> has been upgraded from version 1.855 to 1.857.
465
466=item *
467
468L<Devel::Peek> has been upgraded from version 1.30 to 1.32.
469
470=item *
471
472L<Devel::PPPort> has been upgraded from version 3.62 to 3.68.
473
474=item *
475
476L<diagnostics> has been upgraded from version 1.37 to 1.39.
477
478=item *
479
480L<Digest> has been upgraded from version 1.19 to 1.20.
481
482=item *
483
484L<DynaLoader> has been upgraded from version 1.50 to 1.52.
485
486=item *
487
488L<Encode> has been upgraded from version 3.08 to 3.17.
489
490=item *
491
492L<Errno> has been upgraded from version 1.33 to 1.36.
493
494=item *
495
496L<experimental> has been upgraded from version 0.024 to 0.028.
497
498=item *
499
500L<Exporter> has been upgraded from version 5.76 to 5.77.
501
502=item *
503
504L<ExtUtils::MakeMaker> has been upgraded from version 7.62 to 7.64.
505
506=item *
507
508L<ExtUtils::Miniperl> has been upgraded from version 1.10 to 1.11.
509
510=item *
511
512L<ExtUtils::ParseXS> has been upgraded from version 3.43 to 3.45.
513
514=item *
515
516L<ExtUtils::Typemaps> has been upgraded from version 3.43 to 3.45.
517
518=item *
519
520L<Fcntl> has been upgraded from version 1.14 to 1.15.
521
522=item *
523
524L<feature> has been upgraded from version 1.64 to 1.72.
525
526=item *
527
528L<File::Compare> has been upgraded from version 1.1006 to 1.1007.
529
530=item *
531
532L<File::Copy> has been upgraded from version 2.35 to 2.39.
533
534=item *
535
536L<File::Fetch> has been upgraded from version 1.00 to 1.04.
537
538=item *
539
540L<File::Find> has been upgraded from version 1.39 to 1.40.
541
542=item *
543
544L<File::Glob> has been upgraded from version 1.33 to 1.37.
545
546=item *
547
548L<File::Spec> has been upgraded from version 3.80 to 3.84.
549
550=item *
551
552L<File::stat> has been upgraded from version 1.09 to 1.12.
553
554=item *
555
556L<FindBin> has been upgraded from version 1.52 to 1.53.
557
558=item *
559
560L<GDBM_File> has been upgraded from version 1.19 to 1.23.
561
562=item *
563
564L<Hash::Util> has been upgraded from version 0.25 to 0.28.
565
566=item *
567
568L<Hash::Util::FieldHash> has been upgraded from version 1.21 to 1.26.
569
570=item *
571
572L<HTTP::Tiny> has been upgraded from version 0.076 to 0.080.
573
574=item *
575
576L<I18N::Langinfo> has been upgraded from version 0.19 to 0.21.
577
578=item *
579
580L<if> has been upgraded from version 0.0609 to 0.0610.
581
582=item *
583
584L<IO> has been upgraded from version 1.46 to 1.50.
585
586=item *
587
588IO-Compress has been upgraded from version 2.102 to 2.106.
589
590=item *
591
592L<IPC::Open3> has been upgraded from version 1.21 to 1.22.
593
594=item *
595
596L<JSON::PP> has been upgraded from version 4.06 to 4.07.
597
598=item *
599
600libnet has been upgraded from version 3.13 to 3.14.
601
602=item *
603
604L<Locale::Maketext> has been upgraded from version 1.29 to 1.31.
605
606=item *
607
608L<Math::BigInt> has been upgraded from version 1.999818 to 1.999830.
609
610=item *
611
612L<Math::BigInt::FastCalc> has been upgraded from version 0.5009 to 0.5012.
613
614=item *
615
616L<Math::BigRat> has been upgraded from version 0.2614 to 0.2621.
617
618=item *
619
620L<Module::CoreList> has been upgraded from version 5.20210520 to 5.20220520.
621
622=item *
623
624L<mro> has been upgraded from version 1.25_001 to 1.26.
625
626=item *
627
628L<NEXT> has been upgraded from version 0.68 to 0.69.
629
630=item *
631
632L<Opcode> has been upgraded from version 1.50 to 1.57.
633
634=item *
635
636L<open> has been upgraded from version 1.12 to 1.13.
637
638=item *
639
640L<overload> has been upgraded from version 1.33 to 1.35.
641
642=item *
643
644L<perlfaq> has been upgraded from version 5.20210411 to 5.20210520.
645
646=item *
647
648L<PerlIO> has been upgraded from version 1.11 to 1.12.
649
650=item *
651
652L<Pod::Functions> has been upgraded from version 1.13 to 1.14.
653
654=item *
655
656L<Pod::Html> has been upgraded from version 1.27 to 1.33.
657
658=item *
659
660L<Pod::Simple> has been upgraded from version 3.42 to 3.43.
661
662=item *
663
664L<POSIX> has been upgraded from version 1.97 to 2.03.
665
666=item *
667
668L<re> has been upgraded from version 0.41 to 0.43.
669
670=item *
671
672L<Scalar::Util> has been upgraded from version 1.55 to 1.62.
673
674=item *
675
676L<sigtrap> has been upgraded from version 1.09 to 1.10.
677
678=item *
679
680L<Socket> has been upgraded from version 2.031 to 2.033.
681
682=item *
683
684L<sort> has been upgraded from version 2.04 to 2.05.
685
686=item *
687
688L<Storable> has been upgraded from version 3.23 to 3.26.
689
690=item *
691
692L<Sys::Hostname> has been upgraded from version 1.23 to 1.24.
693
694=item *
695
696L<Test::Harness> has been upgraded from version 3.43 to 3.44.
697
698=item *
699
700L<Test::Simple> has been upgraded from version 1.302183 to 1.302190.
701
702=item *
703
704L<Text::ParseWords> has been upgraded from version 3.30 to 3.31.
705
706=item *
707
708L<Text::Tabs> has been upgraded from version 2013.0523 to 2021.0814.
709
710=item *
711
712L<Text::Wrap> has been upgraded from version 2013.0523 to 2021.0814.
713
714=item *
715
716L<threads> has been upgraded from version 2.26 to 2.27.
717
718=item *
719
720L<threads::shared> has been upgraded from version 1.62 to 1.64.
721
722=item *
723
724L<Tie::Handle> has been upgraded from version 4.2 to 4.3.
725
726=item *
727
728L<Tie::Hash> has been upgraded from version 1.05 to 1.06.
729
730=item *
731
732L<Tie::Scalar> has been upgraded from version 1.05 to 1.06.
733
734=item *
735
736L<Tie::SubstrHash> has been upgraded from version 1.00 to 1.01.
737
738=item *
739
740L<Time::HiRes> has been upgraded from version 1.9767 to 1.9770.
741
742=item *
743
744L<Unicode::Collate> has been upgraded from version 1.29 to 1.31.
745
746=item *
747
748L<Unicode::Normalize> has been upgraded from version 1.28 to 1.31.
749
750=item *
751
752L<Unicode::UCD> has been upgraded from version 0.75 to 0.78.
753
754=item *
755
756L<UNIVERSAL> has been upgraded from version 1.13 to 1.14.
757
758=item *
759
760L<version> has been upgraded from version 0.9928 to 0.9929.
761
762=item *
763
764L<VMS::Filespec> has been upgraded from version 1.12 to 1.13.
765
766=item *
767
768L<VMS::Stdio> has been upgraded from version 2.45 to 2.46.
769
770=item *
771
772L<warnings> has been upgraded from version 1.51 to 1.58.
773
774=item *
775
776L<Win32> has been upgraded from version 0.57 to 0.59.
777
778=item *
779
780L<XS::APItest> has been upgraded from version 1.16 to 1.22.
781
782=item *
783
784L<XS::Typemap> has been upgraded from version 0.18 to 0.19.
785
786=item *
787
788L<XSLoader> has been upgraded from version 0.30 to 0.31.
789
790=back
791
792=head1 Documentation
793
794=head2 New Documentation
795
796=head3 F<Porting/vote_admin_guide.pod>
797
798This document provides the process for administering an election or vote
799within the Perl Core Team.
800
801=head2 Changes to Existing Documentation
802
803We have attempted to update the documentation to reflect the changes
804listed in this document.  If you find any we have missed, open an issue
805at L<https://github.com/Perl/perl5/issues>.
806
807Additionally, the following selected changes have been made:
808
809=head3 L<perlapi>
810
811=over 4
812
813=item *
814
815This has been cleaned up some, and more than 80% of the (previously
816many) undocumented functions have now either been documented or deemed
817to have been inappropriately marked as API.
818
819As always, Patches Welcome!
820
821=back
822
823=head3 L<perldeprecation>
824
825=over 4
826
827=item *
828
829notes the new location for functions moved from L<Pod::Html> to
830L<Pod::Html::Util> that are no longer intended to be used outside of core.
831
832=back
833
834=head3 L<perlexperiment>
835
836=over 4
837
838=item *
839
840notes the C<:win32> IO pseudolayer is removed (this happened in 5.35.2).
841
842=back
843
844=head3 L<perlgov>
845
846=over 4
847
848=item *
849
850The election process has been finetuned to allow the vote to be skipped if there
851are no more candidates than open seats.
852
853=item *
854
855A special election is now allowed to be postponed for up to twelve weeks, for
856example until a normal election.
857
858=back
859
860=head3 L<perlop>
861
862=over 4
863
864=item *
865
866now notes that an invocant only needs to be an object or class name
867for method calls, not for subroutine references.
868
869=back
870
871=head3 L<perlre>
872
873=over 4
874
875=item *
876
877Updated to discourage the use of the /d regexp modifier.
878
879=back
880
881=head3 L<perlrun>
882
883=over 4
884
885=item *
886
887B<-?> is now a synonym for B<-h>
888
889=item *
890
891B<-g> is now a synonym for B<-0777>
892
893=back
894
895=head1 Diagnostics
896
897The following additions or changes have been made to diagnostic output,
898including warnings and fatal error messages.  For the complete list of
899diagnostic messages, see L<perldiag>.
900
901=head2 New Diagnostics
902
903=head3 New Errors
904
905=over 4
906
907=item *
908
909L<Can't "%s" out of a "defer" block|perldiag/"Can't "%s" out of a "defer" block">
910
911(F) An attempt was made to jump out of the scope of a defer block by using
912a control-flow statement such as C<return>, C<goto> or a loop control. This is
913not permitted.
914
915=item *
916
917L<Can't modify %s in %s|perldiag/"Can't modify %s in %s"> (for scalar
918assignment to C<undef>)
919
920Attempting to perform a scalar assignment to C<undef>, for example via
921C<undef = $foo;>, previously triggered a fatal runtime error with the
922message "L<Modification of a read-only value attempted|perldiag/"Modification of a read-only value attempted">."
923It is more helpful to detect such attempted assignments prior to runtime, so
924they are now compile time errors, resulting in the message "Can't modify undef
925operator in scalar assignment".
926
927=item *
928
929L<panic: newFORLOOP, %s|perldiag/"panic: newFORLOOP, %s">
930
931The parser failed an internal consistency check while trying to parse
932a C<foreach> loop.
933
934=back
935
936=head3 New Warnings
937
938=over 4
939
940=item *
941
942L<Built-in function '%s' is experimental|perldiag/"Built-in function '%s' is experimental">
943
944A call is being made to a function in the C<builtin::> namespace, which is
945currently experimental.
946
947=item *
948
949L<defer is experimental|perldiag/"defer is experimental">
950
951The C<defer> block modifier is experimental. If you want to use the feature,
952disable the warning with C<no warnings 'experimental::defer'>, but know that in
953doing so you are taking the risk that your code may break in a future Perl
954version.
955
956=item *
957
958L<Downgrading a use VERSION declaration to below v5.11 is deprecated|perldiag/"Downgrading a use VERSION declaration to below v5.11 is deprecated">
959
960This warning is emitted on a C<use VERSION> statement that
961requests a version below v5.11 (when the effects of C<use strict> would be
962disabled), after a previous declaration of one having a larger number (which
963would have enabled these effects)
964
965=item *
966
967L<for my (...) is experimental|perldiag/"for my (...) is experimental">
968
969This warning is emitted if you use C<for> to iterate multiple values at
970a time. This syntax is currently experimental and its behaviour may
971change in future releases of Perl.
972
973=item *
974
975L<Implicit use of @_ in %s with signatured subroutine is experimental|perldiag/"Implicit use of @_ in %s with signatured subroutine is experimental">
976
977An expression that implicitly involves the C<@_> arguments array was found in
978a subroutine that uses a signature.
979
980=item *
981
982L<Use of @_ in %s with signatured subroutine is experimental|perldiag/"Use of @_ in %s with signatured subroutine is experimental">
983
984An expression involving the C<@_> arguments array was found in a subroutine that uses a signature.
985
986=item *
987
988L<Wide character in $0|perldiag/"Wide character in %s">
989
990Attempts to put wide characters into the program name (C<$0>) now provoke this
991warning.
992
993=back
994
995=head2 Changes to Existing Diagnostics
996
997=over 4
998
999=item *
1000
1001L<'E<sol>' does not take a repeat count in %s|perldiag/"'/' does not take a repeat count in %s">
1002
1003This warning used to not include the C<in %s>.
1004
1005=item *
1006
1007L<Subroutine %s redefined|perldiag/"Subroutine %s redefined">
1008
1009Localized subroutine redefinitions no longer trigger this warning.
1010
1011=item *
1012
1013L<unexpected constant lvalue entersub entry via typeE<sol>targ %d:%d"|perldiag/"panic: unexpected constant lvalue entersub entry via type/targ %d:%d"> now has a panic prefix
1014
1015This makes it consistent with other checks of internal consistency when
1016compiling a subroutine.
1017
1018=item *
1019
1020L<Useless use of sort in scalar context|perldiag/"Useless use of %s in scalar
1021context"> is now in the new C<scalar> category.
1022
1023When C<sort> is used in scalar context, it provokes a warning that doing this
1024is not useful. This warning used to be in the C<void> category. A new category
1025for warnings about scalar context has now been added, called C<scalar>.
1026
1027=item *
1028
1029Removed a number of diagnostics
1030
1031Many diagnostics that have been removed from the perl core across many years
1032have now I<also> been removed from the documentation.
1033
1034=back
1035
1036=head1 Configuration and Compilation
1037
1038=over 4
1039
1040=item *
1041
1042The Perl C source code now uses some C99 features, which we have verified are
1043supported by all compilers we target. This means that Perl's headers now
1044contain some code that is legal in C99 but not C89.
1045
1046This may cause problems for some XS modules that unconditionally add
1047C<-Werror=declaration-after-statement> to their C compiler flags if compiling
1048with gcc or clang. Earlier versions of Perl support long obsolete compilers
1049that are strict in rejecting certain C99 features, particularly mixed
1050declarations and code, and hence it makes sense for XS module authors to audit
1051that their code does not violate this. However, doing this is now only
1052possible on these earlier versions of Perl, hence these modules need to be
1053changed to only add this flag for C<< $] < 5.035005 >>.
1054
1055=item *
1056
1057The makedepend step is now run in parallel by using make
1058
1059When using MAKEFLAGS=-j8, this significantly reduces the time required for:
1060
1061    sh ./makedepend MAKE=make cflags
1062
1063=item *
1064
1065F<Configure> now tests whether C<< #include <xlocale.h> >> is required
1066to use the POSIX 1003 thread-safe locale functions or some related
1067extensions.  This prevents problems where a non-public F<xlocale.h> is
1068removed in a library update, or F<xlocale.h> isn't intended for public
1069use. (github L<#18936|https://github.com/Perl/perl5/pull/18936>)
1070
1071=back
1072
1073=head1 Testing
1074
1075Tests were added and changed to reflect the other additions and changes
1076in this release.
1077
1078=head1 Platform Support
1079
1080=head2 Windows
1081
1082=over 4
1083
1084=item *
1085
1086Support for old MSVC++ (pre-VC12) has been removed
1087
1088These did not support C99 and hence can no longer be used to compile perl.
1089
1090=item *
1091
1092Support for compiling perl on Windows using Microsoft Visual Studio 2022
1093(containing Visual C++ 14.3) has been added.
1094
1095=item *
1096
1097The :win32 IO layer has been removed. This experimental replacement for the
1098:unix layer never reached maturity in its nearly two decades of existence.
1099
1100=back
1101
1102=head2 VMS
1103
1104=over 4
1105
1106=item C<keys %ENV> on VMS returns consistent results
1107
1108On VMS entries in the C<%ENV> hash are loaded from the OS environment on
1109first access, hence the first iteration of C<%ENV> requires the entire
1110environment to be scanned to find all possible keys. This initialisation had
1111always been done correctly for full iteration, but previously was not
1112happening for C<%ENV> in scalar context, meaning that C<scalar %ENV> would
1113return 0 if called before any other C<%ENV> access, or would only return the
1114count of keys accessed if there had been no iteration.
1115
1116These bugs are now fixed - C<%ENV> and C<keys %ENV> in scalar context now
1117return the correct result - the count of all keys in the environment.
1118
1119=back
1120
1121=head2 Discontinued Platforms
1122
1123=over 4
1124
1125=item AT&T UWIN
1126
1127UWIN is a UNIX compatibility layer for Windows.  It was last released
1128in 2012 and has been superseded by Cygwin these days.
1129
1130=item DOS/DJGPP
1131
1132DJGPP is a port of the GNU toolchain to 32-bit x86 systems running
1133DOS.  The last known attempt to build Perl on it was on 5.20, which
1134only got as far as building miniperl.
1135
1136=item NetWare
1137
1138Support code for Novell NetWare has been removed.  NetWare was a
1139server operating system by Novell.  The port was last updated in July
11402002, and the platform itself in May 2009.
1141
1142Unrelated changes accidentally broke the build for the NetWare port in
1143September 2009, and in 12 years no-one has reported this.
1144
1145=back
1146
1147=head2 Platform-Specific Notes
1148
1149=over 4
1150
1151=item z/OS
1152
1153This update enables us to build EBCDIC static/dynamic and 31-bit/64-bit
1154addressing mode Perl. The number of tests that pass is consistent with the
1155baseline before these updates.
1156
1157These changes also provide the base support to be able to provide ASCII
1158static/dynamic and 31-bit/64-bit addressing mode Perl.
1159
1160The z/OS (previously called OS/390) README was updated to describe ASCII and
1161EBCDIC builds.
1162
1163=back
1164
1165=head1 Internal Changes
1166
1167=over 4
1168
1169=item *
1170
1171Since the removal of PERL_OBJECT in Perl 5.8, PERL_IMPLICIT_CONTEXT and
1172MULTIPLICITY have been synonymous and they were being used interchangeably.
1173To simplify the code, all instances of PERL_IMPLICIT_CONTEXT have been
1174replaced with MULTIPLICITY.
1175
1176PERL_IMPLICIT_CONTEXT will remain defined for compatibility with XS modules.
1177
1178=item *
1179
1180The API constant formerly named C<G_ARRAY>, indicating list context, has now
1181been renamed to a more accurate C<G_LIST>.  A compatibilty macro C<G_ARRAY> has
1182been added to allow existing code to work unaffected.  New code should be
1183written using the new constant instead.  This is supported by C<Devel::PPPort>
1184version 3.63.
1185
1186=item *
1187
1188Macros have been added to F<perl.h> to facilitate version comparisons:
1189C<PERL_GCC_VERSION_GE>, C<PERL_GCC_VERSION_GT>, C<PERL_GCC_VERSION_LE> and
1190C<PERL_GCC_VERSION_LT>.
1191
1192Inline functions have been added to F<embed.h> to determine the position of
1193the least significant 1 bit in a word: C<lsbit_pos32> and C<lsbit_pos64>.
1194
1195=item *
1196
1197C<Perl_ptr_table_clear> has been deleted. This has been marked as deprecated
1198since v5.14.0 (released in 2011), and is not used by any code on CPAN.
1199
1200=item *
1201
1202Added new boolean macros and functions. See L</Stable boolean tracking> for
1203related information and L<perlapi> for documentation.
1204
1205=over 4
1206
1207=item *
1208
1209sv_setbool
1210
1211=item *
1212
1213sv_setbool_mg
1214
1215=item *
1216
1217SvIsBOOL
1218
1219=back
1220
1221=item *
1222
1223Added 4 missing functions for dealing with RVs:
1224
1225=over 4
1226
1227=item *
1228
1229sv_setrv_noinc
1230
1231=item *
1232
1233sv_setrv_noinc_mg
1234
1235=item *
1236
1237sv_setrv_inc
1238
1239=item *
1240
1241sv_setrv_inc_mg
1242
1243=back
1244
1245=item *
1246
1247C<xs_handshake()>'s two failure modes now provide distinct messages.
1248
1249=item *
1250
1251Memory for hash iterator state (C<struct xpvhv_aux>) is now allocated as part
1252of the hash body, instead of as part of the block of memory allocated for the
1253main hash array.
1254
1255=item *
1256
1257A new phase_name() interface provides access to the name for each interpreter
1258phase (i.e., PL_phase value).
1259
1260=item *
1261
1262The C<pack> behavior of C<U> has changed for EBCDIC.
1263
1264=item *
1265
1266New equality-test functions C<sv_numeq> and C<sv_streq> have been added, along
1267with C<..._flags>-suffixed variants.  These expose a simple and consistent API
1268to perform numerical or string comparison which is aware of operator
1269overloading.
1270
1271=item *
1272
1273Reading the string form of an integer value no longer sets the flag C<SVf_POK>.
1274The string form is still cached internally, and still re-read directly by the
1275macros C<SvPV(sv)> I<etc> (inline, without calling a C function). XS code that
1276already calls the APIs to get values will not be affected by this change. XS
1277code that accesses flags directly instead of using API calls to express its
1278intent I<might> break, but such code likely is already buggy if passed some
1279other values, such as floating point values or objects with string overloading.
1280
1281This small change permits code (such as JSON serializers) to reliably determine
1282between
1283
1284=over 4
1285
1286=item *
1287
1288a value that was initially B<written> as an integer, but then B<read> as a string
1289
1290    my $answer = 42;
1291    print "The answer is $answer\n";
1292
1293=item *
1294
1295that same value that was initially B<written> as a string, but then B<read> as an integer
1296
1297    my $answer = "42";
1298    print "That doesn't look right\n"
1299        unless $answer == 6 * 9;
1300
1301=back
1302
1303For the first case (originally written as an integer), we now have:
1304
1305    use Devel::Peek;
1306    my $answer = 42;
1307    Dump ($answer);
1308    my $void = "$answer";
1309    print STDERR "\n";
1310    Dump($answer)
1311
1312
1313    SV = IV(0x562538925778) at 0x562538925788
1314      REFCNT = 1
1315      FLAGS = (IOK,pIOK)
1316      IV = 42
1317
1318    SV = PVIV(0x5625389263c0) at 0x562538925788
1319      REFCNT = 1
1320      FLAGS = (IOK,pIOK,pPOK)
1321      IV = 42
1322      PV = 0x562538919b50 "42"\0
1323      CUR = 2
1324      LEN = 10
1325
1326For the second (originally written as a string), we now have:
1327
1328    use Devel::Peek;
1329    my $answer = "42";
1330    Dump ($answer);
1331    my $void = $answer == 6 * 9;
1332    print STDERR "\n";
1333    Dump($answer)'
1334
1335
1336    SV = PV(0x5586ffe9bfb0) at 0x5586ffec0788
1337      REFCNT = 1
1338      FLAGS = (POK,IsCOW,pPOK)
1339      PV = 0x5586ffee7fd0 "42"\0
1340      CUR = 2
1341      LEN = 10
1342      COW_REFCNT = 1
1343
1344    SV = PVIV(0x5586ffec13c0) at 0x5586ffec0788
1345      REFCNT = 1
1346      FLAGS = (IOK,POK,IsCOW,pIOK,pPOK)
1347      IV = 42
1348      PV = 0x5586ffee7fd0 "42"\0
1349      CUR = 2
1350      LEN = 10
1351      COW_REFCNT = 1
1352
1353(One can't rely on the presence or absence of the flag C<SVf_IsCOW> to
1354determine the history of operations on a scalar.)
1355
1356Previously both cases would be indistinguishable, with all 4 flags set:
1357
1358    SV = PVIV(0x55d4d62edaf0) at 0x55d4d62f0930
1359      REFCNT = 1
1360      FLAGS = (IOK,POK,pIOK,pPOK)
1361      IV = 42
1362      PV = 0x55d4d62e1740 "42"\0
1363      CUR = 2
1364      LEN = 10
1365
1366(and possibly C<SVf_IsCOW>, but not always)
1367
1368This now means that if XS code I<really> needs to determine which form a value
1369was first written as, it should implement logic roughly
1370
1371    if (flags & SVf_IOK|SVf_NOK) && !(flags & SVf_POK)
1372        serialize as number
1373    else if (flags & SVf_POK)
1374        serialize as string
1375    else
1376        the existing guesswork ...
1377
1378Note that this doesn't cover "dualvars" - scalars that report different
1379values when asked for their string form or number form (such as C<$!>).
1380Most serialization formats cannot represent such duplicity.
1381
1382I<The existing guesswork> remains because as well as dualvars, values might
1383be C<undef>, references, overloaded references, typeglobs and other things that
1384Perl itself can represent but do not map one-to-one into external formats, so
1385need some amount of approximation or encapsulation.
1386
1387=item *
1388
1389C<sv_dump> (and L<Devel::Peek>’s C<Dump> function) now escapes high-bit
1390octets in the PV as hex rather than octal. Since most folks understand hex
1391more readily than octal, this should make these dumps a bit more legible.
1392This does B<not> affect any other diagnostic interfaces like C<pv_display>.
1393
1394=back
1395
1396=head1 Selected Bug Fixes
1397
1398=over 4
1399
1400=item *
1401
1402utime() now correctly sets errno/C<$!> when called on a closed handle.
1403
1404=item *
1405
1406The flags on the OPTVAL parameter to setsockopt() were previously
1407checked before magic was called, possibly treating a numeric value as
1408a packed buffer or vice versa.  It also ignored the UTF-8 flag,
1409potentially treating the internal representation of an upgraded SV as
1410the bytes to supply to the setsockopt() system call.  (github L<#18660|https://github.com/Perl/perl5/issues/18660>)
1411
1412=item *
1413
1414Only set IOKp, not IOK on $) and $(.
1415This was issue L<#18955|https://github.com/Perl/perl5/issues/18955>: This will prevent serializers from serializing these
1416variables as numbers (which loses the additional groups).
1417This restores behaviour from 5.16
1418
1419=item *
1420
1421Use of the C<mktables> debugging facility would cause perl to croak since
1422v5.31.10; this problem has now been fixed.
1423
1424=item *
1425
1426C<makedepend> logic is now compatible with BSD make (fixes
1427L<GH #19046|https://github.com/Perl/perl5/issues/19046>).
1428
1429=item *
1430
1431Calling C<untie> on a tied hash that is partway through iteration now frees the
1432iteration state immediately.
1433
1434Iterating a tied hash causes perl to store a copy of the current hash key to
1435track the iteration state, with this stored copy passed as the second parameter
1436to C<NEXTKEY>. This internal state is freed immediately when tie hash iteration
1437completes, or if the hash is destroyed, but due to an implementation oversight,
1438it was not freed if the hash was untied. In that case, the internal copy of the
1439key would persist until the earliest of
1440
1441=over 4
1442
1443=item 1
1444
1445C<tie> was called again on the same hash
1446
1447=item 2
1448
1449The (now untied) hash was iterated (ie passed to any of C<keys>, C<values> or
1450C<each>)
1451
1452=item 3
1453
1454The hash was destroyed.
1455
1456=back
1457
1458This inconsistency is now fixed - the internal state is now freed immediately by
1459C<untie>.
1460
1461As the precise timing of this behaviour can be observed with pure Perl code
1462(the timing of C<DESTROY> on objects returned from C<FIRSTKEY> and C<NEXTKEY>)
1463it's just possible that some code is sensitive to it.
1464
1465=item *
1466
1467The C<Internals::getcwd()> function added for bootstrapping miniperl
1468in perl 5.30.0 is now only available in miniperl. [github #19122]
1469
1470=item *
1471
1472Setting a breakpoint on a BEGIN or equivalently a C<use> statement
1473could cause a memory write to a freed C<dbstate> op.
1474[L<GH #19198|https://github.com/Perl/perl5/issues/19198>]
1475
1476=item *
1477
1478When bareword filehandles are disabled, the parser was interpreting
1479any bareword as a filehandle, even when immediatey followed by parens.
1480
1481=back
1482
1483=head1 Errata From Previous Releases
1484
1485=over 4
1486
1487=item *
1488
1489L<perl5300delta> mistakenly identified a CVE whose correct identification is
1490CVE-2015-1592.
1491
1492=back
1493
1494=head1 Obituaries
1495
1496Raun "Spider" Boardman (SPIDB on CPAN), author of at least 66 commits to the
1497Perl 5 core distribution between 1996 and 2002, passed away May 24, 2021 from
1498complications of COVID.  He will be missed.
1499
1500David H. Adler (DHA) passed away on November 16, 2021.  In 1997, David
1501co-founded NY.pm, the first Perl user group, and in 1998 co-founded Perl
1502Mongers to help establish other user groups across the globe.  He was a
1503frequent attendee at Perl conferences in both North America and Europe and well
1504known for his role in organizing I<Bad Movie Night> celebrations at those
1505conferences.  He also contributed to the work of the Perl Foundation, including
1506administering the White Camel awards for community service.  He will be missed.
1507
1508=head1 Acknowledgements
1509
1510Perl 5.36.0 represents approximately a year of development since Perl
15115.34.0 and contains approximately 250,000 lines of changes across 2,000
1512files from 82 authors.
1513
1514Excluding auto-generated files, documentation and release tools, there were
1515approximately 190,000 lines of changes to 1,300 .pm, .t, .c and .h files.
1516
1517Perl continues to flourish into its fourth decade thanks to a vibrant
1518community of users and developers. The following people are known to have
1519contributed the improvements that became Perl 5.36.0:
1520
1521Alyssa Ross, Andrew Fresh, Aristotle Pagaltzis, Asher Mancinelli, Atsushi
1522Sugawara, Ben Cornett, Bernd, Biswapriyo Nath, Brad Barden, Bram, Branislav
1523Zahradník, brian d foy, Chad Granum, Chris 'BinGOs' Williams, Christian
1524Walde (Mithaldu), Christopher Yeleighton, Craig A. Berry, cuishuang, Curtis
1525Poe, Dagfinn Ilmari Mannsåker, Dan Book, Daniel Laügt, Dan Jacobson, Dan
1526Kogai, Dave Cross, Dave Lambley, David Cantrell, David Golden, David
1527Marshall, David Mitchell, E. Choroba, Eugen Konkov, Felipe Gasper, François
1528Perrad, Graham Knop, H.Merijn Brand, Hugo van der Sanden, Ilya Sashcheka,
1529Ivan Panchenko, Jakub Wilk, James E Keenan, James Raspass, Karen Etheridge,
1530Karl Williamson, Leam Hall, Leon Timmermans, Magnus Woldrich, Matthew
1531Horsfall, Max Maischein, Michael G Schwern, Michiel Beijen, Mike Fulton,
1532Neil Bowers, Nicholas Clark, Nicolas R, Niyas Sait, Olaf Alders, Paul Evans,
1533Paul Marquess, Petar-Kaleychev, Pete Houston, Renee Baecker, Ricardo Signes,
1534Richard Leach, Robert Rothenberg, Sawyer X, Scott Baker, Sergey Poznyakoff,
1535Sergey Zhmylove, Sisyphus, Slaven Rezic, Steve Hay, Sven Kirmess, TAKAI
1536Kousuke, Thibault Duponchelle, Todd Rinaldo, Tomasz Konojacki, Tomoyuki
1537Sadahiro, Tony Cook, Unicode Consortium, Yves Orton, Михаил
1538Козачков.
1539
1540The list above is almost certainly incomplete as it is automatically
1541generated from version control history. In particular, it does not include
1542the names of the (very much appreciated) contributors who reported issues to
1543the Perl bug tracker.
1544
1545Many of the changes included in this version originated in the CPAN modules
1546included in Perl's core. We're grateful to the entire CPAN community for
1547helping Perl to flourish.
1548
1549For a more complete list of all of Perl's historical contributors, please
1550see the AUTHORS file in the Perl source distribution.
1551
1552=head1 Reporting Bugs
1553
1554If you find what you think is a bug, you might check the perl bug database
1555at L<https://github.com/Perl/perl5/issues>.  There may also be information at
1556L<http://www.perl.org/>, the Perl Home Page.
1557
1558If you believe you have an unreported bug, please open an issue at
1559L<https://github.com/Perl/perl5/issues>.  Be sure to trim your bug down to a
1560tiny but sufficient test case.
1561
1562If the bug you are reporting has security implications which make it
1563inappropriate to send to a public issue tracker, then see
1564L<perlsec/SECURITY VULNERABILITY CONTACT INFORMATION>
1565for details of how to report the issue.
1566
1567=head1 Give Thanks
1568
1569If you wish to thank the Perl 5 Porters for the work we had done in Perl 5,
1570you can do so by running the C<perlthanks> program:
1571
1572    perlthanks
1573
1574This will send an email to the Perl 5 Porters list with your show of thanks.
1575
1576=head1 SEE ALSO
1577
1578The F<Changes> file for an explanation of how to view exhaustive details on
1579what changed.
1580
1581The F<INSTALL> file for how to build Perl.
1582
1583The F<README> file for general stuff.
1584
1585The F<Artistic> and F<Copying> files for copyright information.
1586
1587=cut
1588