This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta: update updated modules
[perl5.git] / pod / perldelta.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 perldelta - what is new for perl v5.27.6
6
7 =head1 DESCRIPTION
8
9 This document describes differences between the 5.27.5 release and the 5.27.6
10 release.
11
12 If you are upgrading from an earlier release such as 5.27.4, first read
13 L<perl5275delta>, which describes differences between 5.27.4 and 5.27.5.
14
15 =head1 Core Enhancements
16
17 =head2 Initialisation of aggregate state variables
18
19 A persistent lexical array or hash variable can now be initialized,
20 by an expression such as C<state @a = qw(x y z)>.  Initialization of a
21 list of persistent lexical variables is still not possible.
22
23 =head2 Full-size inode numbers
24
25 On platforms where inode numbers are of a type larger than perl's native
26 integer numerical types, L<stat|perlfunc/stat> will preserve the full
27 content of large inode numbers by returning them in the form of strings of
28 decimal digits.  Exact comparison of inode numbers can thus be achieved by
29 comparing with C<eq> rather than C<==>.  Comparison with C<==>, and other
30 numerical operations (which are usually meaningless on inode numbers),
31 work as well as they did before, which is to say they fall back to
32 floating point, and ultimately operate on a fairly useless rounded inode
33 number if the real inode number is too big for the floating point format.
34
35 =head1 Incompatible Changes
36
37 =head2 Yada-yada is now strictly a statement
38
39 By the time of its initial stable release in Perl 5.12, the C<...>
40 (yada-yada) operator was explicitly intended to serve as a statement,
41 not an expression.  However, the original implementation was confused
42 on this point, leading to inconsistent parsing.  The operator was
43 accidentally accepted in a few situations where it did not serve as a
44 complete statement, such as
45
46     ... . "foo";
47     ... if $a < $b;
48
49 The parsing has now been made consistent, permitting yada-yada only as
50 a statement.  Affected code can use C<do{...}> to put a yada-yada into
51 an arbitrary expression context.
52
53 =head2 Subroutines no longer need typeglobs
54
55 Perl 5.22.0 introduced an optimization allowing subroutines to be stored in
56 packages as simple sub refs, not requiring a full typeglob (thus
57 potentially saving large amounts of memeory).  However, the optimization
58 was flawed: it only applied to the main package.
59
60 This optimization has now been extended to all packages.  This may break
61 compatibility with introspection code that looks inside stashes and expects
62 everything in them to be a typeglob.
63
64 When this optimization happens, the typeglob still notionally exists, so
65 accessing it will cause the stash entry to be upgraded to a typeglob.  The
66 optimization does not apply to XSUBs or exported subroutines, and calling a
67 method will undo it, since method calls cache things in typeglobs.
68
69 (This change actually happened in perl 5.27.5 but was omitted from its perldelta.)
70
71 [perl #129916] [perl #132252]
72
73 =head2 Sort algorithm can no longer be specified
74
75 Since Perl 5.8, the L<sort> pragma has had subpragmata C<_mergesort>,
76 C<_quicksort>, and C<_qsort> that can be used to specify which algorithm
77 perl should use to implement the L<sort|perlfunc/sort> builtin.
78 This was always considered a dubious feature that might not last,
79 hence the underscore spellings, and they were documented as not being
80 portable beyond Perl 5.8.  These subpragmata have now been deleted,
81 and any attempt to use them is an error.  The L<sort> pragma otherwise
82 remains, and the algorithm-neutral C<stable> subpragma can be used to
83 control sorting behaviour.
84 [perl #119635]
85
86 =head1 Performance Enhancements
87
88 =over 4
89
90 =item *
91
92 Many string concatenation expressions are now considerably faster, due
93 to the introduction internally of a C<multiconcat> opcode which combines
94 multiple concatenations, and optionally a C<=> or C<.=>, into a single
95 action. For example, apart from retrieving C<$s>, C<$a> and C<$b>, this
96 whole expression is now handled as a single op:
97
98     $s .= "a=$a b=$b\n"
99
100 As a special case, if the LHS of an assignment is a lexical variable or
101 C<my $s>, the op itself handles retrieving the lexical variable, which
102 is faster.
103
104 In general, the more the expression includes a mix of constant strings and
105 variable expressions, the longer the expression, and the more it mixes
106 together non-utf8 and utf8 strings, the more marked the performance
107 improvement. For example on a C<x86_64> system, this code has been
108 benchmarked running four times faster:
109
110     my $s;
111     my $a = "ab\x{100}cde";
112     my $b = "fghij";
113     my $c = "\x{101}klmn";
114
115     for my $i (1..10_000_000) {
116         $s = "\x{100}wxyz";
117         $s .= "foo=$a bar=$b baz=$c";
118     }
119
120 In addition, C<sprintf> expressions which have a constant format
121 containing only C<%s> and C<%%> format elements, and which have a fixed
122 number of arguments, are now also optimised into a C<multiconcat> op.
123
124 =item *
125
126 Subroutines in packages no longer need to be stored in typeglobs, saving
127 large amounts of memory.  See L</Subroutines no longer need typeglobs>
128 under L</Incompatible Changes>, above.
129
130 =back
131
132 =head1 Modules and Pragmata
133
134 Key highlights in this release across several modules:
135
136 =head2 Removal of use vars
137
138 The usage of C<use vars> has been discouraged since the introduction of C<our> in
139 Perl 5.6.0. Where possible the usage of this pragma has now been removed from
140 the Perl source code.
141
142 This had a slight effect (for the better) on the output of WARNING_BITS in B::Deparse.
143
144 =head2 Use of DynaLoader changed to XSLoader in many modules
145
146 XSLoader is more modern, and most modules already require perl 5.6 or greater, so
147 no functionality is lost by switching. In some cases, we have also made changes to
148 the local implementation that may not be reflected in the version on CPAN due
149 to a desire to maintain more backwards compatibility.
150
151 =head2 Updated Modules and Pragmata
152
153 =over 4
154
155 =item *
156
157 L<Attribute::Handlers> has been upgraded from version 1.00 to 1.01.
158
159 =item *
160
161 L<attributes> has been upgraded from version 0.31 to 0.32.
162
163 =item *
164
165 L<B> has been upgraded from version 1.70 to 1.72.
166
167 =item *
168
169 L<B::Concise> has been upgraded from version 1.002 to 1.003.
170
171 =item *
172
173 L<B::Deparse> has been upgraded from version 1.43 to 1.45.
174
175 =item *
176
177 L<base> has been upgraded from version 2.26 to 2.27.
178
179 =item *
180
181 L<blib> has been upgraded from version 1.06 to 1.07.
182
183 =item *
184
185 L<Carp> has been upgraded from version 1.43 to 1.44.
186
187 If a package on the call stack contains a constant named C<ISA>, Carp no
188 longer throws a "Not a GLOB reference" error.
189
190 =item *
191
192 L<Compress::Raw::Zlib> has been upgraded from version 2.074 to 2.075.
193
194 This addresses a security vulnerability in older versions of the 'zlib' library
195 (which is bundled with Compress-Raw-Zlib).
196
197 =item *
198
199 L<Config::Extensions> has been upgraded from version 0.01 to 0.02.
200
201 =item *
202
203 L<Devel::PPPort> has moved from cpan-first to perl-first maintenance
204
205 Primary responsibility for the code in Devel::PPPort has moved into core perl.
206 In a practical sense there should be no change except that hopefully it will
207 stay more up to date with changes made to symbols in perl, rather than needing
208 to be updated after the fact.
209
210 =item *
211
212 L<DynaLoader> has been upgraded from version 1.42 to 1.44.
213
214 =item *
215
216 L<experimental> has been upgraded from version 0.016 to 0.017.
217
218 =item *
219
220 L<ExtUtils::CBuilder> has been upgraded from version 0.280228 to 0.280229.
221
222 =item *
223
224 L<ExtUtils::Embed> has been upgraded from version 1.34 to 1.35.
225
226 =item *
227
228 L<ExtUtils::Miniperl> has been upgraded from version 1.06 to 1.07.
229
230 =item *
231
232 L<ExtUtils::ParseXS> has been upgraded from version 3.35 to 3.36.
233
234 =item *
235
236 L<ExtUtils::Typemaps> has been upgraded from version 3.35 to 3.36.
237
238 =item *
239
240 L<ExtUtils::XSSymSet> has been upgraded from version 1.3 to 1.4.
241
242 =item *
243
244 L<fields> has been upgraded from version 2.23 to 2.24.
245
246 =item *
247
248 L<File::Copy> has been upgraded from version 2.32 to 2.33.  It will now use
249 Time::HiRes utime where available (perl #132401).
250
251 =item *
252
253 L<File::Spec> has been upgraded from version 3.68 to 3.70.
254
255 =item *
256
257 L<File::stat> has been upgraded from version 1.07 to 1.08.
258
259 =item *
260
261 L<FileCache> has been upgraded from version 1.09 to 1.10.
262
263 =item *
264
265 L<Filter::Simple> has been upgraded from version 0.94 to 0.95.
266
267 =item *
268
269 L<Hash::Util::FieldHash> has been upgraded from version 1.19 to 1.20.
270
271 =item *
272
273 L<I18N::Langinfo> has been upgraded from version 0.14 to 0.15.
274
275 =item *
276
277 L<I18N::LangTags> has been upgraded from version 0.42 to 0.43.
278
279 =item *
280
281 The libnet distribution has been upgraded from version 3.10 to 3.11.
282
283 =item *
284
285 L<Locale::Maketext> has been upgraded from version 1.28 to 1.29.
286
287 =item *
288
289 L<Module::CoreList> has been upgraded from version 5.20171020 to 5.20171120.
290
291 =item *
292
293 L<Net::Ping> has been upgraded from version 2.55 to 2.62.
294
295 =item *
296
297 L<ODBM_File> has been upgraded from version 1.14 to 1.15.
298
299 =item *
300
301 L<Opcode> has been upgraded from version 1.40 to 1.41.
302
303 =item *
304
305 L<Pod::Html> has been upgraded from version 1.2202 to 1.2203.
306
307 =item *
308
309 L<POSIX> has been upgraded from version 1.78 to 1.80.
310
311 =item *
312
313 L<re> has been upgraded from version 0.35 to 0.36.
314
315 =item *
316
317 L<SelfLoader> has been upgraded from version 1.24 to 1.25.
318
319 =item *
320
321 L<Socket> has been upgraded from version 2.020_03 to 2.020_04.
322
323 =item *
324
325 L<sort> has been upgraded from version 2.03 to 2.04.
326
327 =item *
328
329 L<Storable> has been upgraded from version 2.64 to 2.65.
330
331 =item *
332
333 L<Test> has been upgraded from version 1.30 to 1.31.
334
335 =item *
336
337 L<Test::Simple> has been upgraded from version 1.302103 to 1.302111.
338
339 =item *
340
341 L<threads> has been upgraded from version 2.18 to 2.19.
342
343 =item *
344
345 L<Tie::Array> has been upgraded from version 1.06 to 1.07.
346
347 =item *
348
349 L<Tie::StdHandle> has been upgraded from version 4.4 to 4.5.
350
351 =item *
352
353 L<Time::gmtime> has been upgraded from version 1.03 to 1.04.
354
355 =item *
356
357 L<Time::HiRes> has been upgraded from version 1.9746 to 1.9747.
358
359 =item *
360
361 L<Time::localtime> has been upgraded from version 1.02 to 1.03.
362
363 =item *
364
365 L<Unicode::Collate> has been upgraded from version 1.19 to 1.23.
366
367 =item *
368
369 L<Unicode::Normalize> has been upgraded from version 1.25 to 1.26.
370
371 =item *
372
373 L<User::grent> has been upgraded from version 1.01 to 1.02.
374
375 =item *
376
377 L<User::pwent> has been upgraded from version 1.00 to 1.01.
378
379 =item *
380
381 L<VMS::DCLsym> has been upgraded from version 1.08 to 1.09.
382
383 =item *
384
385 L<VMS::Stdio> has been upgraded from version 2.42 to 2.44.
386
387 =item *
388
389 L<warnings> has been upgraded from version 1.37 to 1.38.
390
391 =item *
392
393 L<XS::Typemap> has been upgraded from version 0.15 to 0.16.
394
395 =item *
396
397 L<XSLoader> has been upgraded from version 0.27 to 0.28.
398
399 =back
400
401 =head1 Documentation
402
403 =head2 Changes to Existing Documentation
404
405 We have attempted to update the documentation to reflect the changes
406 listed in this document.  If you find any we have missed, send email
407 to L<perlbug@perl.org|mailto:perlbug@perl.org>.
408
409 Additionally, the following selected changes have been made:
410
411 =over 4
412
413 =item * L<perldiag/Variable length lookbehind not implemented in regex m/%s/>
414
415 This now gives more ideas as to workarounds to the issue that was
416 introduced in Perl 5.18 (but not documented explicitly in its perldelta)
417 for the fact that some Unicode C</i> rules cause a few sequences such as
418
419  (?<!st)
420
421 to be considered variable length, and hence disallowed.
422
423 =item * "Use of state $_ is experimental" in L<perldiag>
424
425 This entry has been removed, as the experimental support of this construct was
426 removed in perl 5.24.0.
427
428 =item *
429
430 The section on reference counting in L<perlguts> has been heavily revised,
431 to describe references in the way a programmer needs to think about them
432 rather than in terms of the physical data structures.
433
434 =item *
435
436 The section "Truth and Falsehood" in L<perlsyn> has been removed from
437 that document, where it didn't belong, and merged into the existing
438 paragraph on the same topic in L<perldata>.
439
440 =item *
441
442 The description of the C<x> operator in L<perlop> has been clarified.  [perl #132460]
443
444 =item *
445
446 L<perluniprops> has been updated to note that C<\p{Word}> now includes
447 code points matching the C<\p{Join_Control}> property.  The change to
448 the property was made in Perl 5.18, but not documented until now.  There
449 are currently only two code points that match this property U+200C (ZERO
450 WIDTH NON-JOINER) and U+200D (ZERO WIDTH JOINER).
451
452 =item *
453
454 The entry for C<$+> in perlvar has been expanded upon to describe handling of
455 multiply-named capturing groups.
456
457 =item *
458
459 L<perlop> has been updated to note that C<qw>'s whitespace rules differ from that of
460 C<split>'s in that only ASCII whitespace is used.
461
462 =item *
463
464 L<POSIX> has been updated with some more cautions about using locale-specific
465 functions in threaded applications.
466
467 =back
468
469 =head1 Diagnostics
470
471 The following additions or changes have been made to diagnostic output,
472 including warnings and fatal error messages.  For the complete list of
473 diagnostic messages, see L<perldiag>.
474
475 =head2 Changes to Existing Diagnostics
476
477 =over 4
478
479 =item *
480
481 The diagnostic C<Initialization of state variables in list context
482 currently forbidden> has changed to C<Initialization of state variables
483 in list currently forbidden>, because list-context initialization of
484 single aggregate state variables is now permitted.
485
486 =back
487
488 =head1 Utility Changes
489
490 =head2 L<perlbug>
491
492 =over 4
493
494 =item *
495
496 C<--help> and C<--version> options have been added.
497
498 =back
499
500 =head1 Configuration and Compilation
501
502 =over 4
503
504 =item C89 requirement
505
506 Perl has been documented as requiring a C89 compiler to build since October
507 1998.  A variety of simplifications have now been made to Perl's internals to
508 rely on the features specified by the C89 standard. We believe that this
509 internal change hasn't altered the set of platforms that Perl builds on, but
510 please report a bug if Perl now has new problems building on your platform.
511
512 =item New probes
513
514 =over 2
515
516 =item HAS_BUILTIN_ADD_OVERFLOW
517
518 =item HAS_BUILTIN_MUL_OVERFLOW
519
520 =item HAS_BUILTIN_SUB_OVERFLOW
521
522 =item HAS_THREAD_SAFE_NL_LANGINFO_L
523
524 =item HAS_LOCALECONV_L
525
526 =item HAS_MBRLEN
527
528 =item HAS_MBRTOWC
529
530 =item HAS_MEMRCHR
531
532 =item HAS_NANOSLEEP
533
534 =item HAS_STRNLEN
535
536 =item HAS_STRTOLD_L
537
538 =item I_WCHAR
539
540 =back
541
542 =back
543
544 =head1 Packaging
545
546 For the past few years we have released perl using three different archive
547 formats: bzip (C<.bz2>), LZMA2 (C<.xz>) and gzip (C<.gz>). Since xz compresses
548 better and decompresses faster, and gzip is more compatible and uses less memory,
549 we have dropped the C<.bz2> archive format with this release.
550 (If this poses a problem, do let us know; see L</Reporting Bugs>, below.)
551
552 =head1 Platform Support
553
554 =head2 Discontinued Platforms
555
556 =over 4
557
558 =item PowerUX / Power MAX OS
559
560 Compiler hints and other support for these apparently long-defunct platforms has been removed.
561
562 =back
563
564 =head2 Platform-Specific Notes
565
566 =over 4
567
568 =item Windows
569
570 Visual C++ compiler version detection has been improved to work on non-English
571 language systems.
572
573 =back
574
575 =head1 Internal Changes
576
577 =over 4
578
579 =item *
580
581 A new optimisation phase has been added to the compiler,
582 C<optimize_optree()>, which does a top-down scan of a complete optree
583 just before the peephole optimiser is run. This phase is not currently
584 hookable.
585
586 =item *
587
588 An C<OP_MULTICONCAT> op has been added. At C<optimize_optree()> time, a
589 chain of C<OP_CONCAT> and C<OP_CONST> ops, together optionally with an
590 C<OP_STRINGIFY> and/or C<OP_SASSIGN>, are combined into a single
591 C<OP_MULTICONCAT> op. The op is of type C<UNOP_AUX>, and the aux array
592 contains the argument count, plus a pointer to a constant string and a set
593 of segment lengths. For example with
594
595     my $x = "foo=$foo, bar=$bar\n";
596
597 the constant string would be C<"foo=, bar=\n"> and the segment lengths
598 would be (4,6,1). If the string contains characters such as C<\x80>, whose
599 representation changes under utf8, two sets of strings plus lengths are
600 precomputed and stored.
601
602 =item *
603
604 Direct access to L<C<PL_keyword_plugin>|perlapi/PL_keyword_plugin> is not
605 safe in the presence of multithreading. A new
606 L<C<wrap_keyword_plugin>|perlapi/wrap_keyword_plugin> function has been
607 added to allow XS modules to safely define custom keywords even when
608 loaded from a thread, analogous to L<C<PL_check>|perlapi/PL_check> /
609 L<C<wrap_op_checker>|perlapi/wrap_op_checker>.
610
611 =back
612
613 =head1 Selected Bug Fixes
614
615 =over 4
616
617 =item *
618
619 C<stat()>, C<lstat()>, and file test operators now fail if given a
620 filename containing a nul character, in the same way that C<open()>
621 already fails.
622
623 =item *
624
625 C<stat()>, C<lstat()>, and file test operators now reliably set C<$!> when
626 failing due to being applied to a closed or otherwise invalid file handle.
627
628 =item *
629
630 File test operators for Unix permission bits that don't exist on a
631 particular platform, such as C<-k> (sticky bit) on Windows, now check that
632 the file being tested exists before returning the blanket false result,
633 and yield the appropriate errors if the argument doesn't refer to a file.
634
635 =item *
636
637 The in-place reverse optimisation now correctly strengthens weak
638 references using the L<C<sv_rvunweaken()>|perlapi/sv_rvunweaken>
639 API function.
640
641 =item *
642
643 Fixed a read before buffer when parsing a range starting with C<\N{}>
644 at the beginning of the character set for the transliteration
645 operator.  [perl #132245]
646
647 =item *
648
649 Fixed a leaked SV when parsing an empty C<\N{}> at compile-time.
650 [perl #132245]
651
652 =item *
653
654 Calling C<do $path> on a directory or block device now yields a meaningful
655 error code in C<$!>.  [perl #125774]
656
657 =item *
658
659 Regexp substitution using an overloaded replacement value that provides
660 a tainted stringification now correctly taints the resulting string.
661 [perl #115266]
662
663 =item *
664
665 Lexical sub declarations in C<do> blocks such as C<do { my sub lex; 123 }>
666 could corrupt the stack, erasing items already on the stack in the
667 enclosing statement.  This has been fixed.  [perl #132442]
668
669 =back
670
671 =head1 Errata From Previous Releases
672
673 =over 4
674
675 =item *
676
677 L</Subroutines no longer need typeglobs> under L</Incompatible Changes>, above,
678 was made for perl 5.27.5 but was mistakenly omitted from its perldelta.
679
680 =back
681
682 =head1 Acknowledgements
683
684 XXX Generate this with:
685
686   perl Porting/acknowledgements.pl v5.27.5..HEAD
687
688 =head1 Reporting Bugs
689
690 If you find what you think is a bug, you might check the perl bug database
691 at L<https://rt.perl.org/> .  There may also be information at
692 L<http://www.perl.org/> , the Perl Home Page.
693
694 If you believe you have an unreported bug, please run the L<perlbug> program
695 included with your release.  Be sure to trim your bug down to a tiny but
696 sufficient test case.  Your bug report, along with the output of C<perl -V>,
697 will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
698
699 If the bug you are reporting has security implications which make it
700 inappropriate to send to a publicly archived mailing list, then see
701 L<perlsec/SECURITY VULNERABILITY CONTACT INFORMATION>
702 for details of how to report the issue.
703
704 =head1 Give Thanks
705
706 If you wish to thank the Perl 5 Porters for the work we had done in Perl 5,
707 you can do so by running the C<perlthanks> program:
708
709     perlthanks
710
711 This will send an email to the Perl 5 Porters list with your show of thanks.
712
713 =head1 SEE ALSO
714
715 The F<Changes> file for an explanation of how to view exhaustive details on
716 what changed.
717
718 The F<INSTALL> file for how to build Perl.
719
720 The F<README> file for general stuff.
721
722 The F<Artistic> and F<Copying> files for copyright information.
723
724 =cut