This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Module::CoreList for 5.27.6
[perl5.git] / pod / perldelta.pod
CommitLineData
44691e6f
AB
1=encoding utf8
2
3=head1 NAME
4
e6a2e5ca 5perldelta - what is new for perl v5.27.6
89853d76 6
b5cbfe35 7=head1 DESCRIPTION
89853d76 8
e6a2e5ca 9This document describes differences between the 5.27.5 release and the 5.27.6
b5cbfe35 10release.
89853d76 11
e6a2e5ca
SH
12If you are upgrading from an earlier release such as 5.27.4, first read
13L<perl5275delta>, which describes differences between 5.27.4 and 5.27.5.
14
e6a2e5ca
SH
15=head1 Core Enhancements
16
f99042c8
Z
17=head2 Initialisation of aggregate state variables
18
19A persistent lexical array or hash variable can now be initialized,
20by an expression such as C<state @a = qw(x y z)>. Initialization of a
21list of persistent lexical variables is still not possible.
22
2e8ea15a
Z
23=head2 Full-size inode numbers
24
25On platforms where inode numbers are of a type larger than perl's native
26integer numerical types, L<stat|perlfunc/stat> will preserve the full
27content of large inode numbers by returning them in the form of strings of
28decimal digits. Exact comparison of inode numbers can thus be achieved by
29comparing with C<eq> rather than C<==>. Comparison with C<==>, and other
30numerical operations (which are usually meaningless on inode numbers),
31work as well as they did before, which is to say they fall back to
32floating point, and ultimately operate on a fairly useless rounded inode
33number if the real inode number is too big for the floating point format.
34
e6a2e5ca
SH
35=head1 Incompatible Changes
36
29d69c3c
Z
37=head2 Yada-yada is now strictly a statement
38
39By 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,
41not an expression. However, the original implementation was confused
42on this point, leading to inconsistent parsing. The operator was
43accidentally accepted in a few situations where it did not serve as a
44complete statement, such as
45
46 ... . "foo";
47 ... if $a < $b;
48
49The parsing has now been made consistent, permitting yada-yada only as
50a statement. Affected code can use C<do{...}> to put a yada-yada into
51an arbitrary expression context.
52
7d65f652
FC
53=head2 Subroutines no longer need typeglobs
54
55Perl 5.22.0 introduced an optimization allowing subroutines to be stored in
56packages as simple sub refs, not requiring a full typeglob (thus
57potentially saving large amounts of memeory). However, the optimization
58was flawed: it only applied to the main package.
59
60This optimization has now been extended to all packages. This may break
61compatibility with introspection code that looks inside stashes and expects
62everything in them to be a typeglob.
63
64When this optimization happens, the typeglob still notionally exists, so
65accessing it will cause the stash entry to be upgraded to a typeglob. The
66optimization does not apply to XSUBs or exported subroutines, and calling a
67method will undo it, since method calls cache things in typeglobs.
68
4c46c124
KE
69(This change actually happened in perl 5.27.5 but was omitted from its perldelta.)
70
7d65f652
FC
71[perl #129916] [perl #132252]
72
e2091bb6
Z
73=head2 Sort algorithm can no longer be specified
74
75Since Perl 5.8, the L<sort> pragma has had subpragmata C<_mergesort>,
76C<_quicksort>, and C<_qsort> that can be used to specify which algorithm
77perl should use to implement the L<sort|perlfunc/sort> builtin.
78This was always considered a dubious feature that might not last,
79hence the underscore spellings, and they were documented as not being
80portable beyond Perl 5.8. These subpragmata have now been deleted,
81and any attempt to use them is an error. The L<sort> pragma otherwise
82remains, and the algorithm-neutral C<stable> subpragma can be used to
83control sorting behaviour.
4c46c124 84[perl #119635]
a8ba758d 85
cf663f87
AC
86=head1 Performance Enhancements
87
1b510166
S
88=over 4
89
90=item *
91
8ed1839e
DM
92Many string concatenation expressions are now considerably faster, due
93to the introduction internally of a C<multiconcat> opcode which combines
94multiple concatenations, and optionally a C<=> or C<.=>, into a single
95action. For example, apart from retrieving C<$s>, C<$a> and C<$b>, this
96whole expression is now handled as a single op:
97
98 $s .= "a=$a b=$b\n"
99
4c46c124 100As a special case, if the LHS of an assignment is a lexical variable or
8ed1839e
DM
101C<my $s>, the op itself handles retrieving the lexical variable, which
102is faster.
103
104In general, the more the expression includes a mix of constant strings and
105variable expressions, the longer the expression, and the more it mixes
106together non-utf8 and utf8 strings, the more marked the performance
107improvement. For example on a C<x86_64> system, this code has been
108benchmarked 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
120In addition, C<sprintf> expressions which have a constant format
121containing only C<%s> and C<%%> format elements, and which have a fixed
122number of arguments, are now also optimised into a C<multiconcat> op.
d912eab8 123
7d65f652
FC
124=item *
125
126Subroutines in packages no longer need to be stored in typeglobs, saving
127large amounts of memory. See L</Subroutines no longer need typeglobs>
128under L</Incompatible Changes>, above.
129
c83a3d01 130=back
d912eab8 131
c83a3d01 132=head1 Modules and Pragmata
af94b3ac 133
4c46c124 134Key highlights in this release across several modules:
e6a2e5ca 135
9b78f210
TR
136=head2 Removal of use vars
137
4c46c124 138The usage of C<use vars> has been discouraged since the introduction of C<our> in
9b78f210
TR
139Perl 5.6.0. Where possible the usage of this pragma has now been removed from
140the Perl source code.
141
1218f5ba
TR
142This had a slight effect (for the better) on the output of WARNING_BITS in B::Deparse.
143
4c46c124 144=head2 Use of DynaLoader changed to XSLoader in many modules
9b78f210 145
4c46c124
KE
146XSLoader is more modern, and most modules already require perl 5.6 or greater, so
147no functionality is lost by switching. In some cases, we have also made changes to
148the local implementation that may not be reflected in the version on CPAN due
149to a desire to maintain more backwards compatibility.
64b9a139 150
e6a2e5ca
SH
151=head2 Updated Modules and Pragmata
152
153=over 4
64b9a139
SH
154
155=item *
156
b5af74de
FC
157L<Carp> has been upgraded from version 1.43 to 1.44.
158
159If a package on the call stack contains a constant named C<ISA>, Carp no
160longer throws a "Not a GLOB reference" error.
64b9a139 161
d7408e7a
JK
162=item *
163
4c46c124
KE
164L<Devel::PPPort> has moved from cpan-first to perl-first maintenance
165
166Primary responsibility for the code in Devel::PPPort has moved into core perl.
167In a practical sense there should be no change except that hopefully it will
168stay more up to date with changes made to symbols in perl, rather than needing
169to be updated after the fact.
170
171=item *
172
d7408e7a 173L<File::Copy> has been upgraded from version 2.32 to 2.33. It will now use
4c46c124 174Time::HiRes utime where available (perl #132401).
d7408e7a 175
ad3f654c
JK
176=item *
177
178To address a security vulnerability in older versions of the 'zlib' library
179(which is bundled with Compress-Raw-Zlib), L<Compress::Raw::Zlib> has been
180upgraded to CPAN version 2.075.
181
7358a033
JK
182=item *
183
184L<Test::Simple> has been upgraded from version 1.302103 to 1.302111.
185
e6a2e5ca 186=back
64b9a139 187
e6a2e5ca
SH
188=head2 Removed Modules and Pragmata
189
190=over 4
64b9a139
SH
191
192=item *
193
e6a2e5ca 194XXX
64b9a139 195
e6a2e5ca 196=back
64b9a139 197
e6a2e5ca 198=head1 Documentation
64b9a139 199
e6a2e5ca 200=head2 Changes to Existing Documentation
64b9a139 201
e6a2e5ca
SH
202We have attempted to update the documentation to reflect the changes
203listed in this document. If you find any we have missed, send email
204to L<perlbug@perl.org|mailto:perlbug@perl.org>.
64b9a139 205
e6a2e5ca
SH
206Additionally, the following selected changes have been made:
207
04f89ea7
Z
208=over 4
209
210=item * L<perldiag/Variable length lookbehind not implemented in regex m/%s/>
754dd754
KW
211
212This now gives more ideas as to workarounds to the issue that was
213introduced in Perl 5.18 (but not documented explicitly in its perldelta)
214for the fact that some Unicode C</i> rules cause a few sequences such as
215
216 (?<!st)
217
218to be considered variable length, and hence disallowed.
64b9a139 219
4c46c124
KE
220=item * "Use of state $_ is experimental" in L<perldiag>
221
222This entry has been removed, as the experimental support of this construct was
223removed in perl 5.24.0.
224
64b9a139
SH
225=item *
226
2b8b74b0
Z
227The section on reference counting in L<perlguts> has been heavily revised,
228to describe references in the way a programmer needs to think about them
229rather than in terms of the physical data structures.
230
231=item *
232
77fae439
Z
233The section "Truth and Falsehood" in L<perlsyn> has been removed from
234that document, where it didn't belong, and merged into the existing
235paragraph on the same topic in L<perldata>.
236
237=item *
238
4c46c124 239The description of the C<x> operator in L<perlop> has been clarified. [perl #132460]
e509fc38
Z
240
241=item *
242
6ce1ac11
KW
243L<perluniprops> has been updated to note that C<\p{Word}> now includes
244code points matching the C<\p{Join_Control}> property. The change to
245the property was made in Perl 5.18, but not documented until now. There
246are currently only two code points that match this property U+200C (ZERO
247WIDTH NON-JOINER) and U+200D (ZERO WIDTH JOINER).
64b9a139 248
4c46c124 249=item *
64b9a139 250
4c46c124
KE
251The entry for C<$+> in perlvar has been expanded upon to describe handling of
252multiply-named capturing groups.
64b9a139 253
4c46c124 254=item *
64b9a139 255
4c46c124
KE
256L<perlop> has been updated to note that C<qw>'s whitespace rules differ from that of
257C<split>'s in that only ASCII whitespace is used.
64b9a139
SH
258
259=item *
260
4c46c124
KE
261L<POSIX> has been updated with some more cautions about using locale-specific
262functions in threaded applications.
64b9a139 263
e6a2e5ca
SH
264=back
265
4c46c124 266=head1 Diagnostics
64b9a139 267
4c46c124
KE
268The following additions or changes have been made to diagnostic output,
269including warnings and fatal error messages. For the complete list of
270diagnostic messages, see L<perldiag>.
e6a2e5ca
SH
271
272=head2 Changes to Existing Diagnostics
64b9a139 273
e6a2e5ca 274=over 4
64b9a139
SH
275
276=item *
277
f99042c8
Z
278The diagnostic C<Initialization of state variables in list context
279currently forbidden> has changed to C<Initialization of state variables
280in list currently forbidden>, because list-context initialization of
281single aggregate state variables is now permitted.
282
e6a2e5ca
SH
283=back
284
285=head1 Utility Changes
286
4c46c124 287=head2 L<perlbug>
e6a2e5ca
SH
288
289=over 4
64b9a139
SH
290
291=item *
292
4c46c124 293C<--help> and C<--version> options have been added.
e6a2e5ca
SH
294
295=back
296
297=head1 Configuration and Compilation
298
e6a2e5ca 299=over 4
64b9a139 300
5952a840
AC
301=item C89 requirement
302
303Perl has been documented as requiring a C89 compiler to build since October
515c1ce3 3041998. A variety of simplifications have now been made to Perl's internals to
5952a840
AC
305rely on the features specified by the C89 standard. We believe that this
306internal change hasn't altered the set of platforms that Perl builds on, but
307please report a bug if Perl now has new problems building on your platform.
308
dea26044 309=item New probes
64b9a139 310
dea26044
MB
311=over 2
312
313=item HAS_BUILTIN_ADD_OVERFLOW
314
315=item HAS_BUILTIN_MUL_OVERFLOW
316
317=item HAS_BUILTIN_SUB_OVERFLOW
318
319=item HAS_THREAD_SAFE_NL_LANGINFO_L
320
321=item HAS_LOCALECONV_L
322
323=item HAS_MBRLEN
324
325=item HAS_MBRTOWC
326
327=item HAS_MEMRCHR
328
329=item HAS_NANOSLEEP
330
331=item HAS_STRNLEN
332
333=item HAS_STRTOLD_L
334
335=item I_WCHAR
336
337=back
e6a2e5ca
SH
338
339=back
340
e94f172c
KE
341=head1 Packaging
342
343For the past few years we have released perl using three different archive
344formats: bzip (C<.bz2>), LZMA2 (C<.xz>) and gzip (C<.gz>). Since xz compresses
345better and decompresses faster, and gzip is more compatible and uses less memory,
346we have dropped the C<.bz2> archive format with this release.
347(If this poses a problem, do let us know; see L</Reporting Bugs>, below.)
348
a8ba758d 349=head1 Platform Support
cf663f87 350
e6a2e5ca
SH
351=head2 Discontinued Platforms
352
e6a2e5ca
SH
353=over 4
354
4c46c124 355=item PowerUX / Power MAX OS
e6a2e5ca 356
4c46c124 357Compiler hints and other support for these apparently long-defunct platforms has been removed.
e6a2e5ca
SH
358
359=back
360
a8ba758d
JSA
361=head2 Platform-Specific Notes
362
a8ba758d 363=over 4
9ef07b78 364
40ed7988 365=item Windows
a8ba758d 366
40ed7988
SH
367Visual C++ compiler version detection has been improved to work on non-English
368language systems.
a8ba758d
JSA
369
370=back
371
e6a2e5ca
SH
372=head1 Internal Changes
373
a8ba758d 374=over 4
cf663f87 375
21741043 376=item *
c83a3d01 377
8ed1839e
DM
378A new optimisation phase has been added to the compiler,
379C<optimize_optree()>, which does a top-down scan of a complete optree
380just before the peephole optimiser is run. This phase is not currently
381hookable.
382
383=item *
384
385An C<OP_MULTICONCAT> op has been added. At C<optimize_optree()> time, a
386chain of C<OP_CONCAT> and C<OP_CONST> ops, together optionally with an
387C<OP_STRINGIFY> and/or C<OP_SASSIGN>, are combined into a single
388C<OP_MULTICONCAT> op. The op is of type C<UNOP_AUX>, and the aux array
389contains the argument count, plus a pointer to a constant string and a set
390of segment lengths. For example with
391
392 my $x = "foo=$foo, bar=$bar\n";
393
394the constant string would be C<"foo=, bar=\n"> and the segment lengths
395would be (4,6,1). If the string contains characters such as C<\x80>, whose
396representation changes under utf8, two sets of strings plus lengths are
397precomputed and stored.
a8ba758d 398
ee5287f6
LM
399=item *
400
401Direct access to L<C<PL_keyword_plugin>|perlapi/PL_keyword_plugin> is not
402safe in the presence of multithreading. A new
403L<C<wrap_keyword_plugin>|perlapi/wrap_keyword_plugin> function has been
404added to allow XS modules to safely define custom keywords even when
4c46c124 405loaded from a thread, analogous to L<C<PL_check>|perlapi/PL_check> /
ee5287f6
LM
406L<C<wrap_op_checker>|perlapi/wrap_op_checker>.
407
e6a2e5ca
SH
408=back
409
410=head1 Selected Bug Fixes
411
e6a2e5ca 412=over 4
77baf8eb
SH
413
414=item *
415
a155eb05
TC
416C<stat()>, C<lstat()>, and file test operators now fail if given a
417filename containing a nul character, in the same way that C<open()>
418already fails.
419
420=item *
421
c2bb91f9
Z
422C<stat()>, C<lstat()>, and file test operators now reliably set C<$!> when
423failing due to being applied to a closed or otherwise invalid file handle.
424
425=item *
426
a6c31837
Z
427File test operators for Unix permission bits that don't exist on a
428particular platform, such as C<-k> (sticky bit) on Windows, now check that
429the file being tested exists before returning the blanket false result,
430and yield the appropriate errors if the argument doesn't refer to a file.
431
432=item *
433
5bad3c4f
DIM
434The in-place reverse optimisation now correctly strengthens weak
435references using the L<C<sv_rvunweaken()>|perlapi/sv_rvunweaken>
436API function.
e6a2e5ca 437
4faa3060
TC
438=item *
439
440Fixed a read before buffer when parsing a range starting with C<\N{}>
441at the beginning of the character set for the transliteration
442operator. [perl #132245]
443
444=item *
445
446Fixed a leaked SV when parsing an empty C<\N{}> at compile-time.
447[perl #132245]
448
d1ac83c4
DD
449=item *
450
451Calling C<do $path> on a directory or block device now yields a meaningful
452error code in C<$!>. [perl #125774]
453
02d43d4f
FC
454=item *
455
c4f4b223
Z
456Regexp substitution using an overloaded replacement value that provides
457a tainted stringification now correctly taints the resulting string.
458[perl #115266]
459
460=item *
461
02d43d4f
FC
462Lexical sub declarations in C<do> blocks such as C<do { my sub lex; 123 }>
463could corrupt the stack, erasing items already on the stack in the
464enclosing statement. This has been fixed. [perl #132442]
465
e6a2e5ca
SH
466=back
467
e6a2e5ca
SH
468=head1 Errata From Previous Releases
469
470=over 4
8abafd33 471
e6a2e5ca
SH
472=item *
473
4c46c124
KE
474L</Subroutines no longer need typeglobs> under L</Incompatible Changes>, above,
475was made for perl 5.27.5 but was mistakenly omitted from its perldelta.
8abafd33 476
e6a2e5ca 477=back
b2e49ab9 478
e6a2e5ca 479=head1 Acknowledgements
b2e49ab9 480
e6a2e5ca 481XXX Generate this with:
b2e49ab9 482
cab780cc 483 perl Porting/acknowledgements.pl v5.27.5..HEAD
f5b73711 484
44691e6f
AB
485=head1 Reporting Bugs
486
b5cbfe35
S
487If you find what you think is a bug, you might check the perl bug database
488at L<https://rt.perl.org/> . There may also be information at
489L<http://www.perl.org/> , the Perl Home Page.
44691e6f 490
e08634c5
SH
491If you believe you have an unreported bug, please run the L<perlbug> program
492included with your release. Be sure to trim your bug down to a tiny but
493sufficient test case. Your bug report, along with the output of C<perl -V>,
b5cbfe35 494will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
44691e6f 495
87c118b9
DM
496If the bug you are reporting has security implications which make it
497inappropriate to send to a publicly archived mailing list, then see
c0ea3294
SH
498L<perlsec/SECURITY VULNERABILITY CONTACT INFORMATION>
499for details of how to report the issue.
44691e6f 500
390ae6f9
S
501=head1 Give Thanks
502
503If you wish to thank the Perl 5 Porters for the work we had done in Perl 5,
504you can do so by running the C<perlthanks> program:
505
506 perlthanks
507
508This will send an email to the Perl 5 Porters list with your show of thanks.
509
44691e6f
AB
510=head1 SEE ALSO
511
e08634c5
SH
512The F<Changes> file for an explanation of how to view exhaustive details on
513what changed.
44691e6f
AB
514
515The F<INSTALL> file for how to build Perl.
516
517The F<README> file for general stuff.
518
519The F<Artistic> and F<Copying> files for copyright information.
520
521=cut