Debian Codegraph @

upstream/mageia-cauldron/man1/perl5420delta.1

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "PERL5420DELTA 1"
61 .TH PERL5420DELTA 1 2025-07-02 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 perldelta \- what is new for perl v5.42.0
68 .SH DESCRIPTION
69 .IX Header "DESCRIPTION"
70 This document describes differences between the 5.42.0 release and the 5.40.0
71 release.
72 .SH "Core Enhancements"
73 .IX Header "Core Enhancements"
74 .SS "More CORE:: subs"
75 .IX Subsection "More CORE:: subs"
76 \&\f(CW\*(C`chdir\*(C'\fR has been added as a subroutine to the \f(CW\*(C`CORE::\*(C'\fR namespace.
77 .PP
78 Previously, code like \f(CW&CORE::chdir($dir)\fR or \f(CWmy $ref = \e&CORE::chdir;
79 $ref\->($dir)\fR would throw an error saying \f(CW\*(C`&CORE::chdir cannot be called
80 directly\*(C'\fR. These cases are now fully supported.
81 .ie n .SS "New pragma ""source::encoding"""
82 .el .SS "New pragma \f(CWsource::encoding\fP"
83 .IX Subsection "New pragma source::encoding"
84 This allows you to declare that the portion of a program for the
85 remainder of the lexical scope of this pragma is encoded either entirely
86 in ASCII (for \f(CW\*(C`use\ source::encoding\ \*(Aqascii\*(Aq\*(C'\fR) or if UTF\-8 is allowed
87 as well (for \f(CW\*(C`use\ source::encoding\ \*(Aqutf8\*(Aq\*(C'\fR). No other encodings are
88 accepted. The second form is entirely equivalent to \f(CW\*(C`use\ utf8\*(C'\fR, and
89 may be used interchangeably with that.
90 .PP
91 The purpose of this pragma is to catch cases early where you forgot to
92 specify \f(CW\*(C`use\ utf8\*(C'\fR.
93 .PP
94 \&\f(CW\*(C`use\ source::encoding\ \*(Aqascii\*(Aq\*(C'\fR is automatically enabled within the
95 lexical scope of a \f(CW\*(C`use\ v5.41.0\*(C'\fR or higher.
96 .PP
97 \&\f(CW\*(C`no\ source::encoding\*(C'\fR turns off all this checking for the remainder of
98 its lexical scope. The meaning of non\-ASCII characters is then undefined.
99 .ie n .SS "New "":writer"" attribute on field variables"
100 .el .SS "New \f(CW:writer\fP attribute on field variables"
101 .IX Subsection "New :writer attribute on field variables"
102 Classes defined using \f(CW\*(C`use feature \*(Aqclass\*(Aq\*(C'\fR are now able to automatically
103 create writer accessors for scalar fields, by using the \f(CW\*(C`:writer\*(C'\fR attribute,
104 similar to the way that \f(CW\*(C`:reader\*(C'\fR already creates reader accessors.
105 .PP
106 .Vb 4
107 \& class Point {
108 \& field $x :reader :writer :param;
109 \& field $y :reader :writer :param;
110 \& }
111 \&
112 \& my $p = Point\->new( x => 20, y => 40 );
113 \& $p\->set_x(60);
114 .Ve
115 .ie n .SS "New ""any"" and ""all"" operators"
116 .el .SS "New \f(CWany\fP and \f(CWall\fP operators"
117 .IX Subsection "New any and all operators"
118 Two new experimental features have been added, which introduce the
119 list\-processing operators \f(CW\*(C`any\*(C'\fR and \f(CW\*(C`all\*(C'\fR.
120 .PP
121 .Vb 3
122 \& use v5.42;
123 \& use feature \*(Aqkeyword_all\*(Aq;
124 \& no warnings \*(Aqexperimental::keyword_all\*(Aq;
125 \&
126 \& my @numbers = ...
127 \&
128 \& if ( all { $_ % 2 == 0 } @numbers ) {
129 \& say "All the numbers are even";
130 \& }
131 .Ve
132 .PP
133 These keywords operate similarly to \f(CW\*(C`grep\*(C'\fR except that they only
134 ever return true or false, testing if any (or all) of the elements in
135 the list make the testing block yield true. Because of this they can
136 short\-circuit, avoiding the need to test any further elements if a given
137 element determines the eventual result.
138 .PP
139 These are inspired by the same\-named functions in the List::Util module,
140 except that they are implemented as direct core operators, and thus perform
141 faster, and do not produce an additional subroutine call stack frame for
142 invoking the code block.
143 .PP
144 The feature flags enabling those keywords have been named
145 \&\f(CW\*(C`keyword_any\*(C'\fR
146 and \f(CW\*(C`keyword_all\*(C'\fR
147 to avoid confusion with the ability of the \f(CW\*(C`feature\*(C'\fR module
148 to refer to all of its features by using the \f(CW\*(C`:all\*(C'\fR
149 export tag. [GH #23104 <https://github.com/Perl/perl5/issues/23104>]
150 .PP
151 The related experimental warning flags are consequently named
152 \&\f(CW\*(C`experimental::keyword_any\*(C'\fR and \f(CW\*(C`experimental::keyword_all\*(C'\fR.
153 .SS "Apostrophe as a global name separator can be disabled"
154 .IX Subsection "Apostrophe as a global name separator can be disabled"
155 This was deprecated in Perl 5.38 and removed as scheduled in perl
156 5.41.3, but after some discussion has been reinstated by default.
157 .PP
158 This can be controlled with the \f(CW\*(C`apostrophe_as_package_separator\*(C'\fR
159 feature which is enabled by default, but is disabled from the 5.41
160 feature bundle onwards.
161 .PP
162 If you want to disable use within your own code you can explicitly
163 disable the feature:
164 .PP
165 .Vb 1
166 \& no feature "apostrophe_as_package_separator";
167 .Ve
168 .PP
169 Note that disabling this feature only prevents use of apostrophe as a
170 package separator within code; symbolic references still treat \f(CW\*(C`\*(Aq\*(C'\fR as
171 \&\f(CW\*(C`::\*(C'\fR with the feature disabled:
172 .PP
173 .Vb 7
174 \& my $symref = "My\*(AqModule\*(AqVar";
175 \& # default features
176 \& my $x = $My\*(AqModule\*(AqVar; # fine
177 \& no feature "apostrophe_as_package_separator";
178 \& no strict "refs";
179 \& my $y = $$symref; # like $My::Module::Var
180 \& my $z = $My\*(AqModule\*(AqVar; # syntax error
181 .Ve
182 .PP
183 [GH #22644 <https://github.com/Perl/perl5/issues/22644>]
184 .ie n .SS "Lexical method declaration using ""my method"""
185 .el .SS "Lexical method declaration using \f(CWmy method\fP"
186 .IX Subsection "Lexical method declaration using my method"
187 Like \f(CW\*(C`sub\*(C'\fR since Perl version 5.18, \f(CW\*(C`method\*(C'\fR can now be prefixed with the
188 \&\f(CW\*(C`my\*(C'\fR keyword. This declares a subroutine that has lexical, rather than
189 package visibility. See perlclass for more detail.
190 .ie n .SS "Lexical method invocation operator ""\->&"""
191 .el .SS "Lexical method invocation operator \f(CW\->&\fP"
192 .IX Subsection "Lexical method invocation operator ->&"
193 Along with the ability to declare methods lexically, this release also permits
194 invoking a lexical subroutine as if it were a method, bypassing the usual
195 name\-based method resolution.
196 .PP
197 Combined with lexical method declaration, these two new abilities create the
198 effect of having private methods.
199 .SS "Switch and Smart Match operator kept, behind a feature"
200 .IX Subsection "Switch and Smart Match operator kept, behind a feature"
201 The "switch" feature and the smartmatch operator, \f(CW\*(C`~~\*(C'\fR, were introduced in
202 v5.10. Their behavior was significantly changed in v5.10.1. When the
203 "experiment" system was added in v5.18.0, switch and smartmatch were
204 retroactively declared experimental. Over the years, proposals to fix or
205 supplement the features have come and gone.
206 .PP
207 They were deprecated in Perl v5.38.0 and scheduled for removal in
208 Perl v5.42.0. After extensive discussion their removal has been indefinitely
209 postponed. Using them no longer produces a deprecation warning.
210 .PP
211 Switch itself still requires the \f(CW\*(C`switch\*(C'\fR feature, which is enabled
212 by default for feature bundles from v5.9.5 through to v5.34. Switch
213 remains disabled in feature bundles 5.35 and later, but can be
214 separately enabled:
215 .PP
216 .Vb 7
217 \& # no switch here
218 \& use v5.10;
219 \& # switch here
220 \& use v5.36;
221 \& # no switch here
222 \& use feature "switch";
223 \& # switch here
224 .Ve
225 .PP
226 Smart match now requires the \f(CW\*(C`smartmatch\*(C'\fR feature, which is enabled
227 by default and included in all feature bundles up to 5.40. It is
228 disabled for the 5.41 feature bundle and later, but can be separately
229 enabled:
230 .PP
231 .Vb 5
232 \& # smartmatch here
233 \& use v5.41;
234 \& # no smartmatch here
235 \& use feature "smartmatch";
236 \& # smartmatch here
237 .Ve
238 .PP
239 [GH #22752 <https://github.com/Perl/perl5/issues/22752>]
240 .SS "Unicode 16.0 supported"
241 .IX Subsection "Unicode 16.0 supported"
242 Perl now supports Unicode 16.0
243 <https://www.unicode.org/versions/Unicode16.0.0/> including the changes
244 introduced in 15.1 <https://www.unicode.org/versions/Unicode15.1.0/>.
245 .ie n .SS "Assigning logical xor ""^^="" operator"
246 .el .SS "Assigning logical xor \f(CW^^=\fP operator"
247 .IX Subsection "Assigning logical xor ^^= operator"
248 Perl 5.40.0 introduced the logical medium\-precedence exclusive\-or operator
249 \&\f(CW\*(C`^^\*(C'\fR. It was not noticed at the time that the assigning variant \f(CW\*(C`^^=\*(C'\fR was
250 also missing. This is now added.
251 .SH Security
252 .IX Header "Security"
253 .SS "[CVE\-2024\-56406] Heap buffer overflow vulnerability with tr//"
254 .IX Subsection "[CVE-2024-56406] Heap buffer overflow vulnerability with tr//"
255 A heap buffer overflow vulnerability was discovered in Perl.
256 .PP
257 When there are non\-ASCII bytes in the left\-hand\-side of the \f(CW\*(C`tr\*(C'\fR operator,
258 \&\f(CWS_do_trans_invmap()\fR can overflow the destination pointer \f(CW\*(C`d\*(C'\fR.
259 .PP
260 .Vb 2
261 \& $ perl \-e \*(Aq$_ = "\ex{FF}" x 1000000; tr/\exFF/\ex{100}/;\*(Aq
262 \& Segmentation fault (core dumped)
263 .Ve
264 .PP
265 It is believed that this vulnerability can enable Denial of Service or
266 Arbitrary Code Execution attacks on platforms that lack sufficient defenses.
267 .PP
268 This problem was discovered by Nathan Mills and assigned
269 [CVE\-2024\-56406 <https://lists.security.metacpan.org/cve-announce/msg/28708725/>]
270 by the CPAN Security Group <https://security.metacpan.org/>.
271 .PP
272 The patch to fix this issue (87f42aa0e0096e9a346c9672aa3a0bd3bef8c1dd <https://github.com/Perl/perl5/commit/87f42aa0e0096e9a346c9672aa3a0bd3bef8c1dd>) is applicable to all perls that are vulnerable, including those
273 out\-of\-support.
274 .SS "[CVE\-2025\-40909] Perl threads have a working directory race condition where file operations may target unintended paths"
275 .IX Subsection "[CVE-2025-40909] Perl threads have a working directory race condition where file operations may target unintended paths"
276 Perl thread cloning had a working directory race condition where file
277 operations may target unintended paths. Perl 5.42 will no longer chdir
278 to each handle.
279 .PP
280 This problem was discovered by Vincent Lefèvre via [GH #23010 <https://github.com/Perl/perl5/issues/23010>]
281 and assigned [CVE\-2025\-40909 <https://lists.security.metacpan.org/cve-announce/msg/30017499/>]
282 by the CPAN Security Group <https://security.metacpan.org/>.
283 .PP
284 Fixes were provided via [GH #23019 <https://github.com/Perl/perl5/pull/23019>]
285 and [GH #23361 <https://github.com/Perl/perl5/pull/23361>].
286 .SH "Incompatible Changes"
287 .IX Header "Incompatible Changes"
288 .SS "Removed containing function references for functions without eval"
289 .IX Subsection "Removed containing function references for functions without eval"
290 Perl 5.40 reintroduced unconditional references from functions to their
291 containing functions to fix a bug introduced in Perl 5.18 that broke the
292 special behaviour of \f(CW\*(C`eval EXPR\*(C'\fR in package \f(CW\*(C`DB\*(C'\fR which is used by the
293 debugger.
294 .PP
295 In some cases this change led to circular reference chains between closures and
296 other existing references, resulting in memory leaks.
297 .PP
298 This change has been reverted, fixing
299 [GH #22547 <https://github.com/Perl/perl5/issues/22547>] but re\-breaking
300 [GH #19370 <https://github.com/Perl/perl5/issues/19370>].
301 .PP
302 This means the reference loops won\*(Aqt occur, and that lexical variables and
303 functions from enclosing functions may not be visible in the debugger.
304 .PP
305 Note that calling \f(CW\*(C`eval EXPR\*(C'\fR in a function unconditionally causes a function
306 to reference its enclosing functions as it always has.
307 .SH "Performance Enhancements"
308 .IX Header "Performance Enhancements"
309 .IP \(bu 4
310 Constant\-folded strings are now shareable via the Copy\-on\-Write mechanism.
311 [GH #22163 <https://github.com/Perl/perl5/pull/22163>]
312 .Sp
313 The following code would previously have allocated eleven string buffers,
314 each containing one million "A"s:
315 .Sp
316 .Vb 1
317 \& my @scalars; push @scalars, ("A" x 1_000_000) for 0..9;
318 .Ve
319 .Sp
320 Now a single buffer is allocated and shared between a CONST OP and
321 the ten scalar elements of \f(CW@scalars\fR.
322 .Sp
323 Note that any code using this sort of constant to simulate memory leaks
324 (perhaps in test files) must now permute the string in order to trigger
325 a string copy and the allocation of separate buffers. For example,
326 \&\f(CW\*(C`("A" x 1_000_000).time\*(C'\fR might be a suitable small change.
327 .IP \(bu 4
328 \&\f(CW\*(C`tr///\*(C'\fR now runs at the same speed regardless of the internal
329 representation of its operand, as long as the only characters being
330 translated are ASCII\-range, for example \f(CW\*(C`tr/A\-Z/a\-z/\*(C'\fR. Previously, if
331 the internal encoding was UTF\-8, a slower, more general implementation
332 was used.
333 .IP \(bu 4
334 Code that uses the \f(CW\*(C`indexed\*(C'\fR function from the builtin module to generate
335 a list of index/value pairs out of an array or list which is then passed into
336 a two\-variable \f(CW\*(C`foreach\*(C'\fR list to unpack those again is now optimised to be
337 more efficient.
338 .Sp
339 .Vb 1
340 \& my @array = (...);
341 \&
342 \& foreach my ($idx, $val) (builtin::indexed @array) {
343 \& ...
344 \& }
345 .Ve
346 .Sp
347
348 .Sp
349 .Vb 3
350 \& foreach my ($idx, $val) (builtin::indexed LIST...) {
351 \& ...
352 \& }
353 .Ve
354 .Sp
355 In particular, a temporary list twice the size of the original is no longer
356 generated. Instead, the loop iterates down the original array or list
357 in\-place directly, in the same way that \f(CW\*(C`foreach (@array)\*(C'\fR or
358 \&\f(CW\*(C`foreach (LIST)\*(C'\fR would do.
359 .IP \(bu 4
360 The peephole optimizer recognises the following zero\-offset \f(CW\*(C`substr\*(C'\fR patterns
361 and swaps in a new dedicated operator (\f(CW\*(C`OP_SUBSTR_LEFT\*(C'\fR).
362 [GH #22785 <https://github.com/Perl/perl5/issues/22785>]
363 .Sp
364 .Vb 2
365 \& substr($x, 0, ...)
366 \& substr($x, 0, ..., \*(Aq\*(Aq)
367 .Ve
368 .IP \(bu 4
369 The stringification of integers by "print" in perlfunc and "say" in perlfunc,
370 when coming from an \f(CW\*(C`SVt_IV\*(C'\fR, is now more efficient.
371 [GH #22927 <https://github.com/Perl/perl5/issues/22927>]
372 .IP \(bu 4
373 String reversal from a single argument, when the string buffer is not
374 "swiped", is now done in a single pass and is noticeably faster.
375 The extent of the improvement is compiler & hardware dependent.
376 [GH #23012 <https://github.com/Perl/perl5/issues/23012>]
377 .SH "Modules and Pragmata"
378 .IX Header "Modules and Pragmata"
379 .SS "Updated Modules and Pragmata"
380 .IX Subsection "Updated Modules and Pragmata"
381 .IP \(bu 4
382 Archive::Tar has been upgraded from version 3.02_001 to 3.04.
383 .IP \(bu 4
384 B::Deparse has been upgraded from version 1.76 to 1.85.
385 .IP \(bu 4
386 Benchmark has been upgraded from version 1.25 to 1.27.
387 .IP \(bu 4
388 builtin has been upgraded from version 0.014 to 0.019.
389 .IP \(bu 4
390 Compress::Raw::Bzip2 has been upgraded from version 2.212 to 2.213.
391 .IP \(bu 4
392 Compress::Raw::Zlib has been upgraded from version 2.212 to 2.213.
393 .IP \(bu 4
394 Config::Perl::V has been upgraded from version 0.36 to 0.38.
395 .IP \(bu 4
396 CPAN has been upgraded from version 2.36 to 2.38.
397 .IP \(bu 4
398 CPAN::Meta::YAML has been upgraded from version 0.018 to 0.020.
399 .IP \(bu 4
400 Data::Dumper has been upgraded from version 2.189 to 2.192.
401 .IP \(bu 4
402 DB has been upgraded from version 1.08 to 1.09.
403 .IP \(bu 4
404 DBM_Filter has been upgraded from version 0.06 to 0.07.
405 .IP \(bu 4
406 Devel::Peek has been upgraded from version 1.34 to 1.36.
407 .IP \(bu 4
408 Devel::PPPort has been upgraded from version 3.72 to 3.73.
409 .IP \(bu 4
410 Digest::MD5 has been upgraded from version 2.58_01 to 2.59.
411 .IP \(bu 4
412 DynaLoader has been upgraded from version 1.56 to 1.57.
413 .IP \(bu 4
414 experimental has been upgraded from version 0.032 to 0.035.
415 .IP \(bu 4
416 Exporter has been upgraded from version 5.78 to 5.79.
417 .IP \(bu 4
418 ExtUtils::CBuilder has been upgraded from version 0.280240 to 0.280242.
419 .IP \(bu 4
420 ExtUtils::MakeMaker has been upgraded from version 7.70 to 7.76.
421 .IP \(bu 4
422 ExtUtils::ParseXS has been upgraded from version 3.51 to 3.57.
423 .IP \(bu 4
424 ExtUtils::Typemaps has been upgraded from version 3.51 to 3.57.
425 .IP \(bu 4
426 Fcntl has been upgraded from version 1.18 to 1.20.
427 .IP \(bu 4
428 feature has been upgraded from version 1.89 to 1.97.
429 .IP \(bu 4
430 fields has been upgraded from version 2.25 to 2.27.
431 .IP \(bu 4
432 File::Spec has been upgraded from version 3.90 to 3.94.
433 .IP \(bu 4
434 Getopt::Long has been upgraded from version 2.57 to 2.58.
435 .IP \(bu 4
436 HTTP::Tiny has been upgraded from version 0.088 to 0.090.
437 .IP \(bu 4
438 IO::Compress has been upgraded from version 2.212 to 2.213.
439 .IP \(bu 4
440 IO::Socket::IP has been upgraded from version 0.42 to 0.43.
441 .IP \(bu 4
442 IPC::Open3 has been upgraded from version 1.22 to 1.24.
443 .IP \(bu 4
444 locale has been upgraded from version 1.12 to 1.13.
445 .IP \(bu 4
446 Math::BigInt has been upgraded from version 2.003002 to 2.005002.
447 .IP \(bu 4
448 Math::BigInt::FastCalc has been upgraded from version 0.5018 to 0.5020.
449 .IP \(bu 4
450 Math::Complex has been upgraded from version 1.62 to 1.63.
451 .IP \(bu 4
452 Memoize has been upgraded from version 1.16 to 1.17.
453 .IP \(bu 4
454 Module::CoreList has been upgraded from version 5.20240609 to 5.20250702.
455 .IP \(bu 4
456 NDBM_File has been upgraded from version 1.17 to 1.18.
457 .IP \(bu 4
458 ODBM_File has been upgraded from version 1.18 to 1.20.
459 .IP \(bu 4
460 Opcode has been upgraded from version 1.65 to 1.69.
461 .IP \(bu 4
462 overload has been upgraded from version 1.37 to 1.40.
463 .IP \(bu 4
464 parent has been upgraded from version 0.241 to 0.244.
465 .IP \(bu 4
466 perlfaq has been upgraded from version 5.20240218 to 5.20250619.
467 .IP \(bu 4
468 Pod::Usage has been upgraded from version 2.03 to 2.05.
469 .IP \(bu 4
470 podlators has been upgraded from version 5.01_02 to v6.0.2.
471 .IP \(bu 4
472 POSIX has been upgraded from version 2.20 to 2.23.
473 .IP \(bu 4
474 re has been upgraded from version 0.47 to 0.48.
475 .IP \(bu 4
476 Safe has been upgraded from version 2.46 to 2.47.
477 .IP \(bu 4
478 Scalar::Util has been upgraded from version 1.63 to 1.68_01.
479 .IP \(bu 4
480 Search::Dict has been upgraded from version 1.07 to 1.08.
481 .IP \(bu 4
482 SelfLoader has been upgraded from version 1.27 to 1.28.
483 .IP \(bu 4
484 sort has been upgraded from version 2.05 to 2.06.
485 .IP \(bu 4
486 Storable has been upgraded from version 3.32 to 3.37.
487 .IP \(bu 4
488 strict has been upgraded from version 1.13 to 1.14.
489 .IP \(bu 4
490 Term::Table has been upgraded from version 0.018 to 0.024.
491 .IP \(bu 4
492 Test::Harness has been upgraded from version 3.48 to 3.50.
493 .IP \(bu 4
494 Test::Simple has been upgraded from version 1.302199 to 1.302210.
495 .IP \(bu 4
496 Thread has been upgraded from version 3.05 to 3.06.
497 .IP \(bu 4
498 threads has been upgraded from version 2.40 to 2.43.
499 .IP \(bu 4
500 threads::shared has been upgraded from version 1.69 to 1.70.
501 .IP \(bu 4
502 Tie::File has been upgraded from version 1.09 to 1.10.
503 .IP \(bu 4
504 Tie::RefHash has been upgraded from version 1.40 to 1.41.
505 .IP \(bu 4
506 Time::HiRes has been upgraded from version 1.9777 to 1.9778.
507 .IP \(bu 4
508 Time::Piece has been upgraded from version 1.3401_01 to 1.36.
509 .IP \(bu 4
510 Unicode::UCD has been upgraded from version 0.78 to 0.81.
511 .IP \(bu 4
512 utf8 has been upgraded from version 1.25 to 1.27.
513 .IP \(bu 4
514 version has been upgraded from version 0.9930 to 0.9933.
515 .IP \(bu 4
516 VMS::Filespec has been upgraded from version 1.13 to 1.15.
517 .IP \(bu 4
518 warnings has been upgraded from version 1.69 to 1.74.
519 .IP \(bu 4
520 Win32 has been upgraded from version 0.59 to 0.59_01.
521 .IP \(bu 4
522 XS::APItest has been upgraded from version 1.36 to 1.43.
523 .SH Documentation
524 .IX Header "Documentation"
525 .SS "Changes to Existing Documentation"
526 .IX Subsection "Changes to Existing Documentation"
527 We have attempted to update the documentation to reflect the changes
528 listed in this document. If you find any we have missed, open an issue
529 at <https://github.com/Perl/perl5/issues>.
530 .PP
531 Additionally, the following selected changes have been made:
532 .PP
533 \fIperlapi\fR
534 .IX Subsection "perlapi"
535 .IP \(bu 4
536 Combined the documentation for several groups of related functions
537 into single entries.
538 .IP \(bu 4
539 All forms of \f(CWgv_fetchmeth()\fR are now documented together.
540 .IP \(bu 4
541 \&\f(CW\*(C`gv_autoload4\*(C'\fR is now documented with \f(CW\*(C`gv_autoload_pv\*(C'\fR and additional notes added.
542 The long \f(CW\*(C`Perl_\*(C'\fR forms are now listed when available.
543 .PP
544 \fIperldata\fR
545 .IX Subsection "perldata"
546 .IP \(bu 4
547 Binary and octal floating\-point constants (such as \f(CW\*(C`012.345p\-2\*(C'\fR and
548 \&\f(CW\*(C`0b101.11p\-1\*(C'\fR) are now documented. This feature was first introduced in perl
549 5.22.0 together with hexadecimal floating\-point constants and had a few bug
550 fixes in perl 5.28.0, but it was never formally documented.
551 [GH #18664 <https://github.com/Perl/perl5/issues/18664>]
552 .PP
553 \fIperlfunc\fR
554 .IX Subsection "perlfunc"
555 .IP \(bu 4
556 Clarified the description of \f(CW\*(C`ref\*(C'\fR and \f(CW\*(C`reftype\*(C'\fR in relation
557 to built\-in types and class names.
558 .IP \(bu 4
559 Clarified that perl \f(CW\*(C`sort\*(C'\fR is stable (and has been since v5.8.0).
560 .IP \(bu 4
561 The recommended alternatives to the \f(CWrand()\fR function were updated to modern modules
562 recommended by the CPAN Security Group <https://security.metacpan.org/>.
563 [GH #22873 <https://github.com/Perl/perl5/pull/22873>]
564 .PP
565 \fIperlgov\fR
566 .IX Subsection "perlgov"
567 .IP \(bu 4
568 The list of Steering Council and Core Team members have been updated, following the conclusion of
569 the latest election on 2024\-07\-17.
570 .PP
571 \fIperlguts\fR
572 .IX Subsection "perlguts"
573 .IP \(bu 4
574 Added some description of "real" \f(CW\*(C`AV\*(C'\fRs compared to "fake" \f(CW\*(C`AV\*(C'\fRs.
575 .IP \(bu 4
576 Documentation was updated to reflect that mixing \f(CW\*(C`Newx\*(C'\fR, \f(CW\*(C`Renew\*(C'\fR, and
577 \&\f(CW\*(C`Safefree\*(C'\fR vs \f(CW\*(C`malloc\*(C'\fR, \f(CW\*(C`realloc\*(C'\fR, and \f(CW\*(C`free\*(C'\fR are not allowed, and mixing
578 pointers between the 2 classes of APIs is not allowed. Updates made in
579 perlguts and perlclib.
580 .IP \(bu 4
581 Additional caveats have been added to the description of \f(CW\*(C`TARG\*(C'\fR.
582 .PP
583 \fIperlop\fR
584 .IX Subsection "perlop"
585 .IP \(bu 4
586 Portions of perlop are supposed to be ordered so that all the operators
587 wth the same precedence are in a single section, and the sections are
588 ordered so that the highest precedence operators appear first.
589 This ordering has now been restored. Other reorganization was done to
590 improve clarity, with more basic operations described before ones that
591 depend on them.
592 .IP \(bu 4
593 The documentation for here\-docs has been cleaned up and reorganized.
594 Indented here\-docs were formerly documented separately, now the two
595 types have interwoven documentation which is more compact, and easier to
596 understand.
597 .IP \(bu 4
598 The documentation of the \f(CW\*(C`xor\*(C'\fR operator has been expanded.
599 .IP \(bu 4
600 Outdated advice about using relational string operators in UTF\-8 locales
601 has been removed. Use Unicode::Collate for the best results, but
602 these operators will give adequate results on many platforms.
603 .IP \(bu 4
604 Normalized alignment of verbatim sections, fixing how they are displayed by
605 some Pod viewers that strip indentation.
606 .PP
607 \fIperlvar\fR
608 .IX Subsection "perlvar"
609 .IP \(bu 4
610 Entries for \f(CW$#\fR and \f(CW$*\fR have been amended to note that use of them result in a compilation
611 error, not a warning.
612 .SH Diagnostics
613 .IX Header "Diagnostics"
614 The following additions or changes have been made to diagnostic output,
615 including warnings and fatal error messages. For the complete list of
616 diagnostic messages, see perldiag.
617 .SS "New Diagnostics"
618 .IX Subsection "New Diagnostics"
619 \fINew Errors\fR
620 .IX Subsection "New Errors"
621 .IP \(bu 4
622 Use of non\-ASCII character 0x%X illegal when \*(Aquse source::encoding "ascii"\*(Aq is in effect
623 .Sp
624 (F) This pragma forbids non\-ASCII characters within its scope.
625 .IP \(bu 4
626 Undefined subroutine &%s called, close to label \*(Aq%s\*(Aq
627 .Sp
628 (F) The subroutine indicated hasn\*(Aqt been defined, or if it was, it has
629 since been undefined.
630 .Sp
631 This error could also indicate a mistyped package separator, when a
632 single colon was typed instead of two colons. For example, \f(CWFoo:bar()\fR
633 would be parsed as the label \f(CW\*(C`Foo\*(C'\fR followed by an unqualified function
634 name: \f(CW\*(C`foo: bar()\*(C'\fR. [GH #22860 <https://github.com/Perl/perl5/issues/22860>]
635 .PP
636 \fINew Warnings\fR
637 .IX Subsection "New Warnings"
638 .IP \(bu 4
639 _\|_CLASS_\|_ is experimental
640 .Sp
641 (S experimental::class) This warning is emitted if you use the \f(CW\*(C`_\|_CLASS_\|_\*(C'\fR
642 keyword of \f(CW\*(C`use feature \*(Aqclass\*(Aq\*(C'\fR. This keyword is currently
643 experimental and its behaviour may change in future releases of Perl.
644 .IP \(bu 4
645 %s() attempted on handle \f(CW%s\fR opened with \fBopen()\fR
646 .Sp
647 (W io) You called \fBreaddir()\fR, \fBtelldir()\fR, \fBseekdir()\fR, \fBrewinddir()\fR or
648 \&\fBclosedir()\fR on a handle that was opened with \fBopen()\fR. If you want to
649 use these functions to traverse the contents of a directory, you need
650 to open the handle with \fBopendir()\fR.
651 .Sp
652 [GH #22394 <https://github.com/Perl/perl5/issues/22394>]
653 .IP \(bu 4
654 Possible precedence problem between ! and \f(CW%s\fR
655 .Sp
656 (W precedence) You wrote something like
657 .Sp
658 .Vb 4
659 \& !$x < $y # parsed as: (!$x) < $y
660 \& !$x eq $y # parsed as: (!$x) eq $y
661 \& !$x =~ /regex/ # parsed as: (!$x) =~ /regex/
662 \& !$obj isa Some::Class # parsed as: (!$obj) isa Some::Class
663 .Ve
664 .Sp
665 but because \f(CW\*(C`!\*(C'\fR has higher precedence than comparison operators, \f(CW\*(C`=~\*(C'\fR, and
666 \&\f(CW\*(C`isa\*(C'\fR, this is interpreted as comparing/matching the logical negation of the
667 first operand, instead of negating the result of the comparison/match.
668 .Sp
669 To disambiguate, either use a negated comparison/binding operator:
670 .Sp
671 .Vb 3
672 \& $x >= $y
673 \& $x ne $y
674 \& $x !~ /regex/
675 .Ve
676 .Sp
677 \&... or parentheses:
678 .Sp
679 .Vb 4
680 \& !($x < $y)
681 \& !($x eq $y)
682 \& !($x =~ /regex/)
683 \& !($obj isa Some::Class)
684 .Ve
685 .Sp
686 \&... or the low\-precedence \f(CW\*(C`not\*(C'\fR operator:
687 .Sp
688 .Vb 4
689 \& not $x < $y
690 \& not $x eq $y
691 \& not $x =~ /regex/
692 \& not $obj isa Some::Class
693 .Ve
694 .Sp
695 (If you did mean to compare the boolean result of negating the first operand,
696 parenthesize as \f(CW\*(C`(!$x) < $y\*(C'\fR, \f(CW\*(C`(!$x) eq $y\*(C'\fR, etc.)
697 .Sp
698 Note: this warning does not trigger for code like \f(CW\*(C`!!$x == $y\*(C'\fR,
699 i.e. where double negation (\f(CW\*(C`!!\*(C'\fR) is used as a convert\-to\-boolean operator.
700 .SS "Changes to Existing Diagnostics"
701 .IX Subsection "Changes to Existing Diagnostics"
702 .IP \(bu 4
703 %s() attempted on invalid dirhandle \f(CW%s\fR
704 .Sp
705 This was consolidated from separate messages for \fBreaddir()\fR, \fBtelldir()\fR,
706 \&\fBseekdir()\fR, \fBrewinddir()\fR and \fBclosedir()\fR as part of refactoring for
707 [GH #22394 <https://github.com/Perl/perl5/issues/22394>].
708 .IP \(bu 4
709 Useless use of \f(CW%s\fR in void context
710 .Sp
711 This warning now triggers for use of a chained comparison like \f(CW\*(C`0 < $x < 1\*(C'\fR.
712 [GH #22969 <https://github.com/Perl/perl5/issues/22969>]
713 .IP \(bu 4
714 Use of uninitialized value%s
715 .Sp
716 Prevent this warning when accessing a function parameter in \f(CW@_\fR that
717 is an lvalue reference to an untied hash element where the key was
718 undefined. This warning is still produced at the point of call.
719 [GH #22423 <https://github.com/Perl/perl5/issues/22423>]
720 .SH "Utility Changes"
721 .IX Header "Utility Changes"
722 .SS \fIPorting/test\-dist\-modules.pl\fP
723 .IX Subsection "Porting/test-dist-modules.pl"
724 .IP \(bu 4
725 Separate installation (without overwriting installed modules) is now the default.
726 .IP \(bu 4
727 Documentation is significantly enhanced.
728 .SH "Configuration and Compilation"
729 .IX Header "Configuration and Compilation"
730 .IP \(bu 4
731 Fix compilation on platforms (e.g. "Gentoo Prefix") with only a C locale [GH #22569 <https://github.com/Perl/perl5/issues/22569>]
732 Bug first reported downstream bugs.gentoo.org/939014 <https://bugs.gentoo.org/939014>
733 .IP \(bu 4
734 The (mostly undocumented) configuration macro \f(CW\*(C`PERL_STRICT_CR\*(C'\fR has been
735 removed. When enabled (e.g. with \f(CW\*(C`./Configure \-A ccflags=\-DPERL_STRICT_CR\*(C'\fR),
736 it would make the perl parser throw a fatal error when it encountered a CR
737 (carriage return) character in source files. The default (and now only)
738 behavior of the perl parser is to strip CRs paired with newline characters and
739 otherwise treat them as whitespace.
740 .Sp
741 (\f(CW\*(C`PERL_STRICT_CR\*(C'\fR was originally introduced in perl 5.005 to optionally
742 restore backward compatibility with perl 5.004, which had made CR in source
743 files an error. Before that, CR was accepted, but retained literally in quoted
744 multi\-line constructs such as here\-documents, even at the end of a line.)
745 .IP \(bu 4
746 Similarly, the (even less documented) configuration macro \f(CW\*(C`PERL_CR_FILTER\*(C'\fR has
747 been removed. When enabled, it would install a default source filter to strip
748 carriage returns from source code before the parser proper got to see it.
749 .SH Testing
750 .IX Header "Testing"
751 Tests were added and changed to reflect the other additions and
752 changes in this release. Furthermore, these significant changes were
753 made:
754 .IP \(bu 4
755 A new \fIt/run/todo.t\fR test script was added as a place for TODO tests
756 for known unfixed bugs. Patches are welcome to add to this file.
757 .IP \(bu 4
758 Added testing of the perl headers against the C++ compiler
759 corresponding to the C compiler perl is being built with.
760 [GH #22232 <https://github.com/Perl/perl5/issues/22232>]
761 .SH "Platform Support"
762 .IX Header "Platform Support"
763 .SS "Platform\-Specific Notes"
764 .IX Subsection "Platform-Specific Notes"
765 .IP "arm64 Darwin" 4
766 .IX Item "arm64 Darwin"
767 Fix arm64 darwin hints when using use64bitall with Configure [GH #22672 <https://github.com/Perl/perl5/issues/22672>]
768 .IP Android 4
769 .IX Item "Android"
770 Changes to \fIperl_langinfo.h\fR for Android [GH #22650 <https://github.com/Perl/perl5/issues/22650>] related to [GH #22627 <https://github.com/Perl/perl5/issues/22627>].
771 .IP Cygwin 4
772 .IX Item "Cygwin"
773 \&\fIcygwin.c\fR: fix several silly/terrible C errors. [GH #22724 <https://github.com/Perl/perl5/issues/22724>]
774 .Sp
775 Supply an explicit base address for \f(CW\*(C`cygperl*.dll\*(C'\fR that cannot
776 conflict with those generated by \f(CW\*(C`\-\-enable\-auto\-image\-base\*(C'\fR. [GH #22695 <https://github.com/Perl/perl5/issues/22695>][GH #22104 <https://github.com/Perl/perl5/issues/22104>]
777 .IP "MacOS (Darwin)" 4
778 .IX Item "MacOS (Darwin)"
779 Collation of strings using locales on MacOS 15 (Darwin 24) and up has
780 been turned off due to a failed assertion in its libc.
781 .Sp
782 If earlier versions are also experiencing issues (such as failures in
783 \&\fIlocale.t\fR), you can explicitly disable locale collation by adding the
784 \&\f(CW\*(C`\-Accflags=\-DNO_LOCALE_COLLATE\*(C'\fR option to your invocation of \f(CW\*(C`./Configure\*(C'\fR,
785 or just \f(CW\*(C`\-DNO_LOCALE_COLLATE\*(C'\fR to the \f(CW\*(C`ccflags\*(C'\fR and \f(CW\*(C`cppflags\*(C'\fR
786 variables in \fIconfig.sh\fR.
787 .SH "Internal Changes"
788 .IX Header "Internal Changes"
789 .IP \(bu 4
790 The "\f(CW\*(C`sv_strftime_ints\*(C'\fR" in perlapi function is introduced. This is an
791 enhanced version of "\f(CW\*(C`my_strftime\*(C'\fR" in perlapi, which is retained for
792 backwards compatibility. Both are to call \fBstrftime\fR\|(3) when you have
793 the year, month, hour, etc. The new function handles UTF8ness for you,
794 and allows you to specify if you want the possibility of daylight
795 savings time to be considered. \f(CW\*(C`my_strftime\*(C'\fR never considers DST.
796 .IP \(bu 4
797 The \f(CW\*(C`bytes_to_utf8\*(C'\fR, \f(CW\*(C`bytes_from_utf8\*(C'\fR, and \f(CW\*(C`bytes_from_utf8_loc\*(C'\fR
798 functions are no longer experimental.
799 .IP \(bu 4
800 Calls to \fBcall_argv()\fR with the \f(CW\*(C`G_DISCARD\*(C'\fR flag
801 set also ensure the SV parameters constructed from the \f(CW\*(C`argv\*(C'\fR
802 parameter are released before \f(CWcall_argv()\fR returns. Previously they
803 were released on the next FREETMPS. [GH #22255 <https://github.com/Perl/perl5/issues/22255>]
804 .IP \(bu 4
805 When built with the \f(CW\*(C`\-DDEBUGGING\*(C'\fR compile option, perl API functions that
806 take pointers to distinct types of SVs (AVs, HVs or CVs) will check the
807 \&\f(CWSvTYPE()\fR of the passed values to ensure they are valid. Additionally,
808 internal code within core functions that attempts to extract AVs, HVs or CVs
809 from reference values passed in will also perform such checks.
810 .Sp
811 While this has been entirely tested by normal Perl CI testing, there may
812 still be some corner\-cases where these constraints are violated in
813 otherwise\-valid calls. These may require further investigation if they are
814 found, and specific code to be adjusted to account for it.
815 .IP \(bu 4
816 The \f(CWop_dump()\fR function has been expanded to include additional information
817 about the recent \f(CW\*(C`OP_METHSTART\*(C'\fR and \f(CW\*(C`OP_INITFIELD\*(C'\fR ops, as well as for
818 \&\f(CW\*(C`OP_ARGCHECK\*(C'\fR and \f(CW\*(C`OP_ARGELEM\*(C'\fR which had not been done previously.
819 .IP \(bu 4
820 \&\f(CWop_dump()\fR now also has the facility to print extra debugging information
821 about custom operators, if those operators register a helper function via the
822 new \f(CW\*(C`xop_dump\*(C'\fR element of the \f(CW\*(C`XOP\*(C'\fR structure. For more information, see the
823 relevant additions to perlguts.
824 .IP \(bu 4
825 New API functions are introduced to convert strings encoded in UTF\-8 to
826 their ordinal code point equivalent. These are safe to use by default,
827 and generally more convenient to use than the existing ones.
828 .Sp
829 "\f(CW\*(C`utf8_to_uv\*(C'\fR" in perlapi and "\f(CW\*(C`utf8_to_uv_or_die\*(C'\fR" in perlapi replace
830 "\f(CW\*(C`utf8_to_uvchr\*(C'\fR" in perlapi (which is retained for backwards
831 compatibility), but you should convert to use the new forms, as likely
832 you aren\*(Aqt using the old one safely.
833 .Sp
834 To convert in the opposite direction, you can now use
835 "\f(CW\*(C`uv_to_utf8\*(C'\fR" in perlapi. This is not a new function, but a new synonym
836 for "\f(CW\*(C`uvchr_to_utf8\*(C'\fR" in perlapi. It is added so you don\*(Aqt have to learn
837 two sets of names.
838 .Sp
839 There are also two new functions, "\f(CW\*(C`strict_utf8_to_uv\*(C'\fR" in perlapi and
840 "\f(CW\*(C`c9strict_utf8_to_uv\*(C'\fR" in perlapi which do the same thing except when
841 the input string represents a code point that Unicode doesn\*(Aqt accept as
842 legal for interchange, using either the strict original definition
843 (\f(CW\*(C`strict_utf8_to_uv\*(C'\fR), or the looser one given by
844 Unicode Corrigendum #9 <https://www.unicode.org/versions/corrigendum9.html>
845 (\f(CW\*(C`c9strict_utf8_to_uv\*(C'\fR). When the input string represents one of the
846 restricted code points, these functions return the Unicode
847 \&\f(CW\*(C`REPLACEMENT CHARACTER\*(C'\fR instead.
848 .Sp
849 Also "\f(CW\*(C`extended_utf8_to_uv\*(C'\fR" in perlapi is a synonym for \f(CW\*(C`utf8_to_uv\*(C'\fR, for use
850 when you want to emphasize that the entire range of Perl extended UTF\-8
851 is acceptable.
852 .Sp
853 There are also replacement functions for the three more specialized
854 conversion functions that you are unlikely to need to use. Again, the
855 old forms are kept for backwards compatibility, but you should convert
856 to use the new forms.
857 .Sp
858 "\f(CW\*(C`utf8_to_uv_flags\*(C'\fR" in perlapi replaces "\f(CW\*(C`utf8n_to_uvchr\*(C'\fR" in perlapi.
859 .Sp
860 "\f(CW\*(C`utf8_to_uv_errors\*(C'\fR" in perlapi replaces "\f(CW\*(C`utf8n_to_uvchr_error\*(C'\fR" in perlapi.
861 .Sp
862 "\f(CW\*(C`utf8_to_uv_msgs\*(C'\fR" in perlapi replaces
863 "\f(CW\*(C`utf8n_to_uvchr_msgs\*(C'\fR" in perlapi.
864 .Sp
865 Also added are the inverse functions "\f(CW\*(C`uv_to_utf8_flags\*(C'\fR" in perlapi
866 and "\f(CW\*(C`uv_to_utf8_msgs\*(C'\fR" in perlapi, which are synonyms for the existing
867 functions, "\f(CW\*(C`uvchr_to_utf8_flags\*(C'\fR" in perlapi and
868 "\f(CW\*(C`uvchr_to_utf8_flags_msgs\*(C'\fR" in perlapi respectively. These are provided only
869 so you don\*(Aqt have to learn two sets of names.
870 .IP \(bu 4
871 Three new API functions are introduced to convert strings encoded in
872 UTF\-8 to native bytes format (if possible). These are easier to use
873 than the existing ones, and they avoid unnecessary memory allocations.
874 The functions are "\f(CW\*(C`utf8_to_bytes_overwrite\*(C'\fR" in perlapi which is used
875 when it is ok for the input string to be overwritten with the converted
876 result; and "\f(CW\*(C`utf8_to_bytes_new_pv\*(C'\fR" in perlapi and
877 "\f(CW\*(C`utf8_to_bytes_temp_pv\*(C'\fR" in perlapi when the original string must be
878 preserved intact. \f(CW\*(C`utf8_to_bytes_temp_pv\*(C'\fR returns the result in a
879 temporary using perlapi/\f(CW\*(C`SAVEFREEPV\*(C'\fR that will automatically be
880 destroyed. With \f(CW\*(C`utf8_to_bytes_new_pv\*(C'\fR, you are responsible for
881 freeing the newly allocated memory that is returned if the conversion is
882 successful.
883 .Sp
884 The latter two functions are designed to replace
885 "\f(CW\*(C`bytes_from_utf8\*(C'\fR" in perlapi which creates memory unnecessarily, or
886 unnecessarily large.
887 .IP \(bu 4
888 New API functions \f(CWvalid_identifier_pve()\fR,
889 \&\f(CWvalid_identifier_pvn()\fR and
890 \&\f(CWvalid_identifier_sv()\fR have been added, which
891 test if a string would be considered by Perl to be a valid identifier name.
892 .IP \(bu 4
893 When assigning from an SVt_IV into a SVt_NV (or vice versa), providing that
894 both are "bodyless" types, Perl_sv_setsv_flags will now just change the
895 destination type to match the source type. Previously, an SVt_IV would have
896 been upgraded to a SVt_PVNV to store an NV, and an SVt_NV would have been
897 upgraded to a SVt_PVIV to store an IV. This change prevents the need to
898 allocate \- and later free \- the relevant body struct.
899 .IP \(bu 4
900 Two new API functions are introduced to convert strings encoded in
901 native bytes format to UTF\-8. These return the string unchanged if its
902 UTF\-8 representation is the same as the original. Otherwise, new memory
903 is allocated to contain the converted string. This is in contrast to
904 the existing "\f(CW\*(C`bytes_to_utf8\*(C'\fR" in perlapi which always allocates new
905 memory. The new functions are "\f(CW\*(C`bytes_to_utf8_free_me\*(C'\fR" in perlapi and
906 "\f(CW\*(C`bytes_to_utf8_temp_pv\*(C'\fR" in perlapi.
907 "\f(CW\*(C`bytes_to_utf8_temp_pv\*(C'\fR" in perlapi arranges for the new memory to
908 automatically be freed. With \f(CW\*(C`bytes_to_utf8_free_me\*(C'\fR, you are
909 responsible for freeing any newly allocated memory.
910 .IP \(bu 4
911 The way that subroutine signatures are parsed by the parser grammar has been
912 changed.
913 .Sp
914 Previously, when parsing individual signature parameters, the parser would
915 accumulate an \f(CW\*(C`OP_ARGELEM\*(C'\fR optree fragment for each parameter on the parser
916 stack, collecting them in an \f(CW\*(C`OP_LIST\*(C'\fR sequence, before finally building the
917 complete argument handling optree itself, in a large action block defined
918 directly in \fIperly.y\fR.
919 .Sp
920 In the new approach, all the optree generation is handled by newly\-defined
921 functions in \fIop.c\fR which are called by the action blocks in the parser.
922 These do not keep state on the parser stack, but instead in a dedicated memory
923 structure referenced by the main \f(CW\*(C`PL_parser\*(C'\fR structure. This is intended to
924 be largely opaque to other code, and accessed only via the new functions.
925 .Sp
926 This new arrangement is intended to allow more flexible code generation and
927 additional features to be developed in the future.
928 .IP \(bu 4
929 Three new API functions have been added to interact with the regexp global
930 match position stored in an SV. These are \f(CWsv_regex_global_pos_get()\fR,
931 \&\f(CWsv_regex_global_pos_set()\fR and \f(CWsv_regex_global_pos_clear()\fR. Using these
932 API functions avoids XS modules needing to know about or interact directly
933 with the way this position is currently stored, which involves the
934 \&\f(CW\*(C`PERL_MAGIC_regex_global\*(C'\fR magic type.
935 .IP \(bu 4
936 New \f(CW\*(C`SvVSTRING\*(C'\fR API macro
937 .Sp
938 A new API macro has been added, which is used to obtain the second string
939 buffer out of a "vstring" SV, in a manner similar to the \f(CW\*(C`SvPV\*(C'\fR macro which
940 obtains the regular string buffer out of a regular SV.
941 .Sp
942 .Vb 2
943 \& STRLEN len;
944 \& const char *vstr_pv = SvVSTRING(sv, vstr_len);
945 .Ve
946 .Sp
947 See "\f(CW\*(C`SvVSTRING\*(C'\fR" in perlapi.
948 .SH "Selected Bug Fixes"
949 .IX Header "Selected Bug Fixes"
950 .IP \(bu 4
951 Fix null pointer dereference in S_SvREFCNT_dec [GH #16627 <https://github.com/Perl/perl5/issues/16627>].
952 .IP \(bu 4
953 Fix feature \*(Aqclass\*(Aq Segmentation fault in DESTROY [GH #22278 <https://github.com/Perl/perl5/issues/22278>].
954 .IP \(bu 4
955 \&\f(CW\*(C`chdir\*(C'\fR now returns real booleans (as its documentation describes), not
956 integers. This means the result of a failed \f(CW\*(C`chdir\*(C'\fR now stringifies to \f(CW\*(Aq\*(Aq\fR,
957 not \f(CW\*(Aq0\*(Aq\fR.
958 .Sp
959 [GH #22365 <https://github.com/Perl/perl5/issues/22365>]
960 .IP \(bu 4
961 Compound assignment operators return lvalues that can be further modified:
962 .Sp
963 .Vb 4
964 \& ($x &= $y) += $z;
965 \& # Equivalent to:
966 \& # $x &= $y;
967 \& # $x += $z;
968 .Ve
969 .Sp
970 However, the separate numeric/string bitwise operators provided by the
971 \&\f(CW\*(C`bitwise\*(C'\fR feature, \f(CW\*(C`&= ^= |= &.= ^.= |.=\*(C'\fR,
972 did not return such lvalues:
973 .Sp
974 .Vb 4
975 \& use feature qw(bitwise);
976 \& ($x &= $y) += $z;
977 \& # Used to die:
978 \& # Can\*(Aqt modify numeric bitwise and (&) in addition (+) at ...
979 .Ve
980 .Sp
981 This has been corrected. [GH #22412 <https://github.com/Perl/perl5/issues/22412>]
982 .IP \(bu 4
983 Starting in v5.39.8, "\f(CW\*(C`strftime\*(C'\fR" in POSIX would crash or produce odd errors
984 (such as \f(CW\*(C`Out of memory in perl:util:safesysmalloc\*(C'\fR) when given a format
985 string that wasn\*(Aqt actually a string, but a number, \f(CW\*(C`undef\*(C'\fR, or an object
986 (even one with overloaded string conversion).
987 .Sp
988 Now \f(CW\*(C`strftime\*(C'\fR stringifies its first argument, as before.
989 [GH #22498 <https://github.com/Perl/perl5/issues/22498>]
990 .Sp
991 Also, fix \f(CWPOSIX::strftime()\fR [GH #22369 <https://github.com/Perl/perl5/issues/22369>].
992 .IP \(bu 4
993 \&\f(CW\*(C`pack("p", ...)\*(C'\fR and \f(CW\*(C`pack("P", ...)\*(C'\fR now \fBSvPV_force()\fR the supplied
994 SV unless it is read only. This will remove CoW from the SV and
995 prevents code that writes through the generated pointer from modifying
996 the value of other SVs that happen the share the same CoWed string
997 buffer.
998 .Sp
999 Note: this does not make \f(CW\*(C`pack("p",... )\*(C'\fR safe, if the SV is magical
1000 then any writes to the buffer will likely be discarded on the next
1001 read. [GH #22380 <https://github.com/Perl/perl5/issues/22380>]
1002 .IP \(bu 4
1003 Enforce \f(CW\*(C`no feature "bareword_filehandles"\*(C'\fR for bareword file handles
1004 that have strictness removed because they are used in \fBopen()\fR with a
1005 "dup" mode, such as in \f(CW\*(C`open my $fh, ">&", THISHANDLE\*(C'\fR. [GH #22568 <https://github.com/Perl/perl5/issues/22568>]
1006 .IP \(bu 4
1007 Using \f(CW\*(C`goto\*(C'\fR to tail call, or using the \fBcall_sv()\fR and related APIs to
1008 call, any of \fBtrim()\fR, \fBrefaddr()\fR, \fBreftype()\fR, \fBceil()\fR, \fBfloor()\fR or
1009 \&\fBstringify()\fR in the \f(CW\*(C`builtin::\*(C'\fR package would crash or assert due to a
1010 \&\f(CW\*(C`TARG\*(C'\fR handling bug. [GH #22542 <https://github.com/Perl/perl5/issues/22542>]
1011 .IP \(bu 4
1012 Fix \fBsv_gets()\fR to accept a \f(CW\*(C`SSize_t\*(C'\fR append offset instead of \f(CW\*(C`I32\*(C'\fR.
1013 This prevents integer overflows when appending to a large \f(CW\*(C`SV\*(C'\fR for
1014 \&\f(CW\*(C`readpipe\*(C'\fR aka \f(CW\*(C`qx//\*(C'\fR and \f(CW\*(C`readline\*(C'\fR.
1015 <https://www.perlmonks.org/?node_id=11161665>
1016 .IP \(bu 4
1017 Fixed an issue where \f(CW\*(C`utf8n_to_uvchr\*(C'\fR failed to correctly identify
1018 certain invalid UTF\-8 sequences as invalid. Specifically, sequences
1019 that start with continuation bytes or unassigned bytes could cause
1020 unexpected behavior or a panic. This fix ensures that such invalid
1021 sequences are now properly detected and handled. This correction
1022 also resolves related issues in modules that handle UTF\-8 processing,
1023 such as \f(CW\*(C`Encode.pm\*(C'\fR.
1024 .IP \(bu 4
1025 The perl parser would erroneously parse some POD directives
1026 as if they were \f(CW\*(C`=cut\*(C'\fR. Some other POD directives
1027 whose names start with \fIcut\fR, prematurely terminating an embedded POD section.
1028 The following cases were affected: \fIcut\fR followed by a digit (e.g.
1029 \&\f(CW\*(C`=cut2studio\*(C'\fR), \fIcut\fR followed by an underscore (e.g. \f(CW\*(C`=cut_grass\*(C'\fR), and in
1030 string \f(CW\*(C`eval\*(C'\fR, any identifier starting with \fIcut\fR (e.g. \f(CW\*(C`=cute\*(C'\fR).
1031 [GH #22759 <https://github.com/Perl/perl5/issues/22759>]
1032 .IP \(bu 4
1033 Builds with \f(CW\*(C`\-msse\*(C'\fR and quadmath on 32\-bit x86 systems would crash
1034 with a misaligned access early in the build. [GH #22577 <https://github.com/Perl/perl5/issues/22577>]
1035 .IP \(bu 4
1036 On threaded builds on POSIX\-like systems, if the perl signal handler
1037 receives a signal, we now resend the signal to the main perl thread. Previously
1038 this would crash. [GH #22487 <https://github.com/Perl/perl5/issues/22487>]
1039 .IP \(bu 4
1040 Declaring a lexically scoped array or hash using \f(CW\*(C`state\*(C'\fR within a subroutine
1041 and then immediately returning no longer triggers a "Bizarre copy of HASH/ARRAY
1042 in subroutine exit" error. [GH #18630 <https://github.com/Perl/perl5/issues/18630>]
1043 .IP \(bu 4
1044 \&\f(CWbuiltin::trim()\fR didn\*(Aqt properly clear \f(CW\*(C`TARG\*(C'\fR which could result in
1045 out of date cached numeric versions of the value being used on a
1046 second evaluation. Properly clear any cached values. [GH #22784 <https://github.com/Perl/perl5/issues/22784>]
1047 .IP \(bu 4
1048 "shmread" in perlfunc and "shmwrite" in perlfunc are no longer limited to 31\-bit
1049 values and can use all the available bits on a platform for their POS and
1050 SIZE arguments.
1051 [GH #22895 <https://github.com/Perl/perl5/issues/22895>]
1052 .IP \(bu 4
1053 "shmread" in perlfunc is now better behaved if VAR is not a plain string. If VAR
1054 is a tied variable, it calls \f(CW\*(C`STORE\*(C'\fR once; previously, it would also call
1055 \&\f(CW\*(C`FETCH\*(C'\fR, but without using the result. If VAR is a reference, the referenced
1056 entity has its refcount properly decremented when VAR is turned into a string;
1057 previously, it would leak memory.
1058 [GH #22898 <https://github.com/Perl/perl5/issues/22898>]
1059 .IP \(bu 4
1060 The \f(CW$SIG{_\|_DIE_\|_}\fR and \f(CW$SIG{_\|_WARN_\|_}\fR handlers can no longer be invoked
1061 recursively, either deliberately or by accident, as described in
1062 "%SIG" in perlvar. That is, when an exception (or warning) triggers a call to a
1063 \&\f(CW$SIG{_\|_DIE_\|_}\fR (or \f(CW$SIG{_\|_WARN_\|_}\fR) handler, further exceptions (or
1064 warnings) are processed directly, ignoring \f(CW%SIG\fR until the original
1065 \&\f(CW$SIG{_\|_DIE_\|_}\fR (or \f(CW$SIG{_\|_WARN_\|_}\fR) handler call returns.
1066 [GH #14527 <https://github.com/Perl/perl5/issues/14527>], [GH #22984 <https://github.com/Perl/perl5/issues/22984>], [GH #22987 <https://github.com/Perl/perl5/issues/22987>]
1067 .IP \(bu 4
1068 The \f(CWObjectFIELDS()\fR for an object and \f(CW\*(C`xhv_class_fields\*(C'\fR for the
1069 object\*(Aqs stash weren\*(Aqt always NULL or not\-NULL, confusing \f(CWsv_dump()\fR
1070 (and hence Devel::Peek\*(Aqs \f(CWDump()\fR) into crashing on an object with no
1071 defined fields in some cases. [GH #22959 <https://github.com/Perl/perl5/issues/22959>]
1072 .IP \(bu 4
1073 When comparing strings when using a UTF\-8 locale, the behavior was
1074 previously undefined if either or both contained an above\-Unicode code
1075 point, such as 0x110000. Now all such code points will collate the same
1076 as the highest Unicode code point, U+10FFFF. [GH #22989 <https://github.com/Perl/perl5/issues/22989>]
1077 .IP \(bu 4
1078 In regexes, the contents of \f(CW\*(C`\eg{...}\*(C'\fR backreferences are now properly
1079 validated. Previously, \f(CW\*(C`\eg{1 FOO}\*(C'\fR was silently parsed as \f(CW\*(C`\eg{1}\*(C'\fR, ignoring
1080 everything after the first number.
1081 [GH #23050 <https://github.com/Perl/perl5/issues/23050>]
1082 .IP \(bu 4
1083 A run\-time pattern which contained a code block which recursed back to the
1084 same bit of code which ran that match, could cause a crash.
1085 [GH #22869 <https://github.com/Perl/perl5/issues/22869>]
1086 .Sp
1087 For example:
1088 .Sp
1089 .Vb 3
1090 \& my $r = qr/... (?{ foo() if ... }) .../;
1091 \& sub foo { $string =~ $r }
1092 \& foo()
1093 .Ve
1094 .IP \(bu 4
1095 In some cases an \f(CW\*(C`eval\*(C'\fR would not add integer parts to the source
1096 lines saved by the debugger. [GH #23151 <https://github.com/Perl/perl5/issues/23151>]
1097 .IP \(bu 4
1098 In debugging mode, perl saves source lines from all files
1099 (plus an indication of whether each line is breakable)
1100 for use by the debugger. The internal storage format has been
1101 optimized to use less memory.
1102 This should save 24 bytes per stored line for 64\-bit
1103 systems, more for \f(CW\*(C`\-Duselongdouble\*(C'\fR or \f(CW\*(C`\-Dusequadmath\*(C'\fR builds.
1104 Discussed in [GH #23171 <https://github.com/Perl/perl5/issues/23171>].
1105 .IP \(bu 4
1106 Ensure cloning the save stack for fork emulation doesn\*(Aqt duplicate
1107 freeing the RExC state. [GH #23022 <https://github.com/Perl/perl5/issues/23022>]
1108 .IP \(bu 4
1109 Smartmatch against a code reference that uses a loop exit such as
1110 \&\f(CW\*(C`last\*(C'\fR would crash perl. [GH #16608 <https://github.com/Perl/perl5/issues/16608>]
1111 .IP \(bu 4
1112 Class initializers and \f(CW\*(C`ADJUST\*(C'\fR blocks, per perlclass, that
1113 called \f(CW\*(C`last\*(C'\fR or other loop exits would crash perl. Same cause as
1114 for [GH #16608 <https://github.com/Perl/perl5/issues/16608>].
1115 .IP \(bu 4
1116 Exceptions thrown and caught entirely within a \f(CW\*(C`defer {}\*(C'\fR or \f(CW\*(C`finally {}\*(C'\fR
1117 block no longer stop the outer run\-loop.
1118 .Sp
1119 Code such as the following would stop running the contents of the \f(CW\*(C`defer\*(C'\fR
1120 block once the inner exception in the inner \f(CW\*(C`try\*(C'\fR/\f(CW\*(C`catch\*(C'\fR block was caught.
1121 This has now been fixed, and runs as expected. ([GH #23064 <https://github.com/Perl/perl5/issues/23064>]).
1122 .Sp
1123 .Vb 3
1124 \& defer {
1125 \& try { die "It breaks\en"; }
1126 \& catch ($e) { warn $e }
1127 \&
1128 \& say "This line would never run";
1129 \& }
1130 .Ve
1131 .IP \(bu 4
1132 "readline" in perlfunc now clears the error flag if an error occurs when
1133 reading and that error is \f(CW\*(C`EAGAIN\*(C'\fR or \f(CW\*(C`EWOULDBLOCK\*(C'\fR. This allows
1134 code that depended on \f(CW\*(C`readline\*(C'\fR to clear all errors to ignore
1135 these relatively harmless errors. [GH #22883 <https://github.com/Perl/perl5/issues/22883>]
1136 .IP \(bu 4
1137 \&\f(CW\*(C`open\*(C'\fR automatically creates an anonymous temporary file
1138 when passed \f(CW\*(C`undef\*(C'\fR as a filename:
1139 .Sp
1140 .Vb 1
1141 \& open(my $fh, "+>", undef) or die ...
1142 .Ve
1143 .Sp
1144 This is supposed to work only when the undefined value is the one returned by
1145 the \f(CW\*(C`undef\*(C'\fR function.
1146 .Sp
1147 In perls before 5.41.3, this caused a problem due to the fact that the same
1148 undefined value can be generated by lookups of non\-existent hash keys or array
1149 elements, which can lead to bugs in user\-level code (reported as [GH #22385 <https://github.com/Perl/perl5/issues/22385>]).
1150 .Sp
1151 In 5.41.3, additional checks based on the syntax tree of the call site were
1152 added, which fixed this issue for some number of common cases, though not all
1153 of them, at the cost of breaking the ability of APIs that wrap \f(CW\*(C`open\*(C'\fR to
1154 expose its anonymous file mode. A notable example of such an API is autodie.
1155 .Sp
1156 This release reverts to the old problem in preference to the new one for the
1157 time being.
1158 .SH Obituaries
1159 .IX Header "Obituaries"
1160 .SS "Abe Timmerman"
1161 .IX Subsection "Abe Timmerman"
1162 Abe Timmerman (ABELTJE) passed away on August 15, 2024.
1163 .PP
1164 Since 2002, Abe built and maintained the Test::Smoke project: "a
1165 set of scripts and modules that try to run the Perl core tests on as
1166 many configurations as possible and combine the results into an easy to
1167 read report". Smoking Perl on as many platforms and configurations as
1168 possible has been instrumental in finding bugs and developing patches
1169 for those bugs.
1170 .PP
1171 Abe was a regular attendee of the Perl Toolchain Summit (née Perl QA
1172 Hackathon), the Dutch Perl Workshop and the Amsterdam.pm user group
1173 meetings. With his kindness, his smile and his laugh, he helped make
1174 Perl and its community better.
1175 .PP
1176 Abeltje\*(Aqs memorial card said "Grab every opportunity to have a drink of
1177 bubbly. This is an opportunity". We\*(Aqll miss you Abe, and we\*(Aqll have a
1178 drink of bubbly in your honor.
1179 .SS "Andrew Main"
1180 .IX Subsection "Andrew Main"
1181 Andrew Main (ZEFRAM) passed away on March 10, 2025.
1182 .PP
1183 Zefram was a brilliant person, seemingly knowledgeable in everything
1184 and happy to impart his knowledge and share his striking insights with a
1185 gentle, technical demeanor that often failed to convey the genuine care
1186 with which he communicated.
1187 .PP
1188 It would be impossible to overstate the impact that Zefram has had on
1189 both the language and culture of Perl over the years. From his countless
1190 contributions to the code\-base, to his often quirky but always distinctive
1191 appearances at conferences and gatherings, his influence and memory are
1192 sure to endure long into the future.
1193 .PP
1194 Zefram wished to have no designated memorial location in
1195 meatspace. His designated memorial location in cyberspace is
1196 <http://www.fysh.org/~zefram/personal/>.
1197 .SH Acknowledgements
1198 .IX Header "Acknowledgements"
1199 Perl 5.42.0 represents approximately 13 months of development since Perl
1200 5.40.0 and contains approximately 280,000 lines of changes across 1,600
1201 files from 65 authors.
1202 .PP
1203 Excluding auto\-generated files, documentation and release tools, there were
1204 approximately 94,000 lines of changes to 860 .pm, .t, .c and .h files.
1205 .PP
1206 Perl continues to flourish into its fourth decade thanks to a vibrant
1207 community of users and developers. The following people are known to have
1208 contributed the improvements that became Perl 5.42.0:
1209 .PP
1210 Aaron Dill, Andrei Horodniceanu, Andrew Ruthven, Antanas Vaitkus, Aristotle
1211 Pagaltzis, Branislav Zahradník, brian d foy, Chad Granum, Chris \*(AqBinGOs\*(Aq
1212 Williams, Craig A. Berry, Dabrien \*(AqDabe\*(Aq Murphy, Dagfinn Ilmari Mannsåker,
1213 Dan Book, Daniel Dragan, Dan Jacobson, David Cantrell, David Mitchell, E.
1214 Choroba, Ed J, Ed Sabol, Elvin Aslanov, Eric Herman, Erik Huelsmann, Gianni
1215 Ceccarelli, Graham Knop, hbmaclean, H.Merijn Brand, iabyn, James E Keenan,
1216 James Raspass, Johan Vromans, Karen Etheridge, Karl Williamson, Leon
1217 Timmermans, Lukas Mai, Marek Rouchal, Marin Tsanov, Mark Fowler, Masahiro
1218 Honma, Max Maischein, Paul Evans, Paul Johnson, Paul Marquess, Peter
1219 Eisentraut, Peter John Acklam, Philippe Bruhat (BooK), pyrrhlin, Reini
1220 Urban, Richard Leach, Robert Rothenberg, Robin Ragged, Russ Allbery, Scott
1221 Baker, Sergei Zhmylev, Sevan Janiyan, Sisyphus, Štěpán Němec, Steve Hay,
1222 TAKAI Kousuke, Thibault Duponchelle, Todd Rinaldo, Tony Cook, Unicode
1223 Consortium, Vladimír Marek, Yves Orton.
1224 .PP
1225 The list above is almost certainly incomplete as it is automatically
1226 generated from version control history. In particular, it does not include
1227 the names of the (very much appreciated) contributors who reported issues to
1228 the Perl bug tracker.
1229 .PP
1230 Many of the changes included in this version originated in the CPAN modules
1231 included in Perl\*(Aqs core. We\*(Aqre grateful to the entire CPAN community for
1232 helping Perl to flourish.
1233 .PP
1234 For a more complete list of all of Perl\*(Aqs historical contributors, please
1235 see the \fIAUTHORS\fR file in the Perl source distribution.
1236 .SH "Reporting Bugs"
1237 .IX Header "Reporting Bugs"
1238 If you find what you think is a bug, you might check the perl bug database
1239 at <https://github.com/Perl/perl5/issues>. There may also be information at
1240 <https://www.perl.org/>, the Perl Home Page.
1241 .PP
1242 If you believe you have an unreported bug, please open an issue at
1243 <https://github.com/Perl/perl5/issues>. Be sure to trim your bug down to a
1244 tiny but sufficient test case.
1245 .PP
1246 If the bug you are reporting has security implications which make it
1247 inappropriate to send to a public issue tracker, then see
1248 "SECURITY VULNERABILITY CONTACT INFORMATION" in perlsec
1249 for details of how to report the issue.
1250 .SH "Give Thanks"
1251 .IX Header "Give Thanks"
1252 If you wish to thank the Perl 5 Porters for the work we had done in Perl 5,
1253 you can do so by running the \f(CW\*(C`perlthanks\*(C'\fR program:
1254 .PP
1255 .Vb 1
1256 \& perlthanks
1257 .Ve
1258 .PP
1259 This will send an email to the Perl 5 Porters list with your show of thanks.
1260 .SH "SEE ALSO"
1261 .IX Header "SEE ALSO"
1262 The \fIChanges\fR file for an explanation of how to view exhaustive details on
1263 what changed.
1264 .PP
1265 The \fIINSTALL\fR file for how to build Perl.
1266 .PP
1267 The \fIREADME\fR file for general stuff.
1268 .PP
1269 The \fIArtistic\fR and \fICopying\fR files for copyright information.