1PERL5380DELTA(1) Perl Programmers Reference Guide PERL5380DELTA(1)
2
3
4
6 perl5380delta - what is new for perl v5.38.0
7
9 This document describes differences between the 5.36.0 release and the
10 5.38.0 release.
11
13 New "class" Feature
14 A new experimental syntax is now available for defining object classes,
15 where per-instance data is stored in "field" variables that behave like
16 lexicals.
17
18 use feature 'class';
19
20 class Point
21 {
22 field $x;
23 field $y;
24
25 method zero { $x = $y = 0; }
26 }
27
28 This is described in more detail in perlclass. Notes on the internals
29 of its implementation and other related details can be found in
30 perlclassguts.
31
32 This remains a new and experimental feature, and is very much still
33 under development. It will be the subject of much further addition,
34 refinement and alteration in future releases. As it is experimental,
35 it yields warnings in the "experimental::class" category. These can be
36 silenced by a "no warnings" statement.
37
38 use feature 'class';
39 no warnings 'experimental::class';
40
41 Unicode 15.0 is supported
42 See <https://www.unicode.org/versions/Unicode15.0.0/> for details.
43
44 Deprecation warnings now have specific subcategories
45 All deprecation warnings now have their own specific deprecation
46 category which can be disabled individually. You can see a list of all
47 deprecated features in perldeprecation, and in warnings. The following
48 list is from warnings:
49
50 +- deprecated ----+
51 | |
52 | +- deprecated::apostrophe_as_package_separator
53 | |
54 | +- deprecated::delimiter_will_be_paired
55 | |
56 | +- deprecated::dot_in_inc
57 | |
58 | +- deprecated::goto_construct
59 | |
60 | +- deprecated::smartmatch
61 | |
62 | +- deprecated::unicode_property_name
63 | |
64 | +- deprecated::version_downgrade
65
66 It is still possible to disable all deprecation warnings in a single
67 statement with
68
69 no warnings 'deprecated';
70
71 but now is possible to have a finer grained control. As has
72 historically been the case these warnings are automatically enabled
73 with
74
75 use warnings;
76
77 %{^HOOK} API introduced
78 For various reasons it can be difficult to create subroutine wrappers
79 for some of perls keywords. Any keyword which has an undefined
80 prototype simply cannot be wrapped with a subroutine, and some keywords
81 which perl permits to be wrapped are in practice very tricky to wrap.
82 For example "require" is tricky to wrap, it is possible but doing so
83 changes the stack depth, and the standard methods of exporting assume
84 that they will be exporting to a package at certain stack depth up the
85 stack, and the wrapper will thus change where functions are exported to
86 unless implemented with a great deal of care. This can be very awkward
87 to deal with.
88
89 Accordingly we have introduced a new hash called "%{^HOOK}" which is
90 intended to facilitate such cases. When a keyword supports any kind of
91 special hook then the hook will live in this new hash. Hooks in this
92 hash will be named after the function they are called by, followed by
93 two underbars and then the phase they are executed in, currently either
94 before or after the keyword is executed.
95
96 In this initial release we support two hooks "require__before" and
97 "require__after". These are provided to make it easier to perform tasks
98 before and after a require statement.
99
100 See perlvar for more details.
101
102 PERL_RAND_SEED
103 Added a new environment variable "PERL_RAND_SEED" which can be used to
104 cause a perl program which uses "rand" without using srand() explicitly
105 or which uses srand() with no arguments to be repeatable. See perlrun.
106 This feature can be disabled at compile time by passing
107
108 -Accflags=-DNO_PERL_RAND_SEED
109
110 to Configure during the build process.
111
112 Defined-or and logical-or assignment default expressions in signatures
113 The default expression for a subroutine signature parameter can now be
114 assigned using the "//=" or "||=" operators, to apply the defaults
115 whenever the caller provided an undefined or false value
116 (respectively), rather than simply when the parameter is missing
117 entirely. For more detail see the documentation in perlsub.
118
119 @INC Hook Enhancements and $INC and INCDIR
120 The internals for @INC hooks have been hardened to handle various edge
121 cases and should no longer segfault or throw assert failures when hooks
122 modify @INC during a require operation. As part of this we now ensure
123 that any given hook is executed at most once during a require call, and
124 that any duplicate directories do not trigger additional directory
125 probes.
126
127 To provide developers more control over dynamic module lookup, a new
128 hook method "INCDIR" is now supported. An object supporting this method
129 may be injected into the @INC array, and when it is encountered in the
130 module search process it will be executed, just like how INC hooks are
131 executed, and its return value used as a list of directories to search
132 for the module. Returning an empty list acts as a no-op. Note that
133 since any references returned by this hook will be stringified and used
134 as strings, you may not return a hook to be executed later via this
135 API.
136
137 When an @INC hook (either "INC" or "INCDIR") is called during require,
138 the $INC variable will be localized to be the value of the index of
139 @INC that the hook came from. If the hook wishes to override what the
140 "next" index in @INC should be it may update $INC to be one less than
141 the desired index ("undef" is equivalent to -1). This allows an @INC
142 hook to completely rewrite the @INC array and have perl restart its
143 directory probes from the beginning of @INC.
144
145 Blessed CODE references in @INC that do not support the "INC" or
146 "INCDIR" methods will no longer trigger an exception, and instead will
147 be treated the same as unblessed coderefs are, and executed as though
148 they were an "INC" hook.
149
150 Forbidden control flow out of "defer" or "finally" now detected at compile-
151 time
152 It is forbidden to attempt to leave a "defer" or "finally" block by
153 means of control flow such as "return" or "goto". Previous versions of
154 perl could only detect this when actually attempted at runtime.
155
156 This version of perl adds compile-time detection for many cases that
157 can be statically determined. This may mean that code which compiled
158 successfully on a previous version of perl is now reported as a
159 compile-time error with this one. This only happens in cases where it
160 would have been an error to actually execute the code anyway; the error
161 simply happens at an earlier time.
162
163 Optimistic Eval in Patterns
164 The use of "(?{ ... })" and "(??{ ... })" in a pattern disables various
165 optimisations globally in that pattern. This may or may not be desired
166 by the programmer. This release adds the "(*{ ... })" equivalent. The
167 only difference is that it does not and will never disable any
168 optimisations in the regex engine. This may make it more unstable in
169 the sense that it may be called more or less times in the future,
170 however the number of times it executes will truly match how the regex
171 engine functions. For example, certain types of optimisation are
172 disabled when "(?{ ... })" is included in a pattern, so that patterns
173 which are O(N) in normal use become O(N*N) with a "(?{ ... })" pattern
174 in them. Switching to "(*{ ... })" means the pattern will stay O(N).
175
176 REG_INF has been raised from 65,536 to 2,147,483,647
177 Many regex quantifiers used to be limited to "U16_MAX" in the past, but
178 are now limited to "I32_MAX", thus it is now possible to write
179 "/(?:word){1000000}/" for example. Note that doing so may cause the
180 regex engine to run longer and use more memory.
181
182 New API functions optimize_optree and finalize_optree
183 There are two new API functions for operating on optree fragments,
184 ensuring you can invoke the required parts of the optree-generation
185 process that might otherwise not get invoked (e.g. when creating a
186 custom LOGOP). To get access to these functions, you first need to set
187 a "#define" to opt-in to using these functions.
188
189 #define PERL_USE_VOLATILE_API
190
191 These functions are closely tied to the internals of how the
192 interpreter works, and could be altered or removed at any time if other
193 internal changes make that necessary.
194
195 Some "goto"s are now permitted in "defer" and "finally" blocks
196 Perl version 5.36.0 added "defer" blocks and permitted the "finally"
197 keyword to also add similar behaviour to "try"/"catch" syntax. These
198 did not permit any "goto" expression within the body, as it could have
199 caused control flow to jump out of the block. Now, some "goto"
200 expressions are allowed, if they have a constant target label, and that
201 label is found within the block.
202
203 use feature 'defer';
204
205 defer {
206 goto LABEL;
207 print "This does not execute\n";
208 LABEL: print "This does\n";
209 }
210
211 New regexp variable ${^LAST_SUCCESSFUL_PATTERN}
212 This allows access to the last succesful pattern that matched in the
213 current scope. Many aspects of the regex engine refer to the "last
214 successful pattern". The empty pattern reuses it, and all of the magic
215 regex vars relate to it. This allows access to its pattern. The
216 following code
217
218 if (m/foo/ || m/bar/) {
219 s//PQR/;
220 }
221
222 can be rewritten as follows
223
224 if (m/foo/ || m/bar/) {
225 s/${^LAST_SUCCESSFUL_PATTERN}/PQR/;
226 }
227
228 and it will do the exactly same thing.
229
230 Locale category LC_NAME now supported on participating platforms
231 On platforms that have the GNU extension "LC_NAME" category, you may
232 now use it as the category parameter to "setlocale" in POSIX to set and
233 query its locale.
234
236 readline() no longer clears the stream error and eof flags
237 readline(), also spelled "<>", would clear the handle's error and eof
238 flags after an error occurred on the stream.
239
240 In nearly all cases this clear is no longer done, so the error and eof
241 flags now properly reflect the status of the stream after readline().
242
243 Since the error flag is no longer cleared calling close() on the stream
244 may fail and if the stream was not explicitly closed, the implicit
245 close of the stream may produce a warning.
246
247 This has resulted in two main types of problems in downstream CPAN
248 modules, and these may also occur in your code:
249
250 • If your code reads to end of file, and then rebinds the handle to a
251 new file descriptor, previously since the eof flag wasn't set you
252 could continue to read from the stream. You now need to clear the
253 eof flag yourself with "$handle->clearerr()" to continue reading.
254
255 • If your code encounters an error on the stream while reading with
256 readline() you will need to call "$handle->clearerr" to continue
257 reading. The one case this occurred the underlying file descriptor
258 was marked non-blocking, so the read() system call was failing with
259 "EAGAIN", which resulted in the error flag being set on the stream.
260
261 The only case where error and eof flags continue to cleared on error is
262 when reading from the child process for glob() in miniperl. This
263 allows it to correctly report errors from the child process on close().
264 This is unlikely to be an issue during normal perl development.
265
266 [GH #20060 <https://github.com/Perl/perl5/issues/20060>]
267
268 "INIT" blocks no longer run after an exit() in "BEGIN"
269 "INIT" blocks will no longer run after an exit() performed inside of a
270 "BEGIN". This means that the combination of the "-v" option and the
271 "-c" option no longer executes a compile check as well as showing the
272 perl version. The "-v" option executes an exit(0) after printing the
273 version information inside of a "BEGIN" block, and the "-c" check is
274 implemented by using "INIT" hooks, resulting in the "-v" option taking
275 precedence.
276
277 [GH #1537 <https://github.com/Perl/perl5/issues/1537>] [GH #20181
278 <https://github.com/Perl/perl5/issues/20181>]
279
280 Syntax errors no longer produce "phantom error messages"
281 Generally perl will continue parsing the source code even after
282 encountering a compile error. In many cases this is helpful, for
283 instance with misspelled variable names it is helpful to show as many
284 examples of the error as possible. But in the case of syntax errors
285 continuing often produces bizarre error messages and may even cause
286 segmentation faults during the compile process. In this release the
287 compiler will halt at the first syntax error encountered. This means
288 that any code expecting to see the specific error messages we used to
289 produce will be broken. The error that is emitted will be one of the
290 diagnostics that used to be produced, but in some cases some messages
291 that used to be produced will no longer be displayed.
292
293 See "Changes to Existing Diagnostics" for more details.
294
295 utf8::upgrade()
296 Starting in this release, if the input string is "undef", it remains
297 "undef". Previously it would be changed into a defined, zero-length
298 string.
299
300 Changes to "thread-safe" locales
301 Perl 5.28 introduced "thread-safe" locales on systems that supported
302 them, namely modern Windows, and systems supporting POSIX 2008 locale
303 operations. These systems accomplish this by having per-thread
304 locales, while continuing to support the older global locale operations
305 for code that doesn't take the steps necessary to use the newer per-
306 thread ones.
307
308 It turns out that some POSIX 2008 platforms have or have had buggy
309 implementations, which forced perl to not use them. The
310 "${^SAFE_LOCALES}" scalar variable contains 0 or 1 to indicate whether
311 or not the current platform is considered by perl to have a working
312 thread-safe implementation. Some implementations have been fixed
313 already, but FreeBSD and Cygwin have been newly discovered to be
314 sufficiently buggy that the thread-safe operations are no longer used
315 by perl, starting in this release. Hence, "${^SAFE_LOCALES}" is now 0
316 for them. Older versions of perl can be configured to avoid these
317 buggy implementations by adding the Configure option
318 "-DNO_POSIX_2008_LOCALE".
319
320 And v5.38 fixes a bug in all previous perls that led to locales not
321 being fully thread-safe. The first thread that finishes caused the
322 main thread (named "thread0") to revert to the global locale in effect
323 at startup, discarding whatever the thread's locale had been previously
324 set to. If any other thread had switched to the global locale by
325 calling switch_to_global_locale() in XS code, those threads would all
326 share the global locale, and "thread0" would not be thread-safe.
327
329 Use of "'" as a package name separator is deprecated
330 Using "'" as package separator in a variable named in a double-quoted
331 string has warned since 5.28. It is now deprecated in both string
332 interpolation and non-interpolated contexts, and will be removed in
333 Perl 5.42.
334
335 Switch and Smart Match operator
336 The "switch" feature and the smartmatch operator, "~~", were introduced
337 in v5.10. Their behavior was significantly changed in v5.10.1. When
338 the "experiment" system was added in v5.18.0, switch and smartmatch
339 were retroactively declared experimental. Over the years, proposals to
340 fix or supplement the features have come and gone.
341
342 In v5.38.0, we are declaring the experiment a failure. Some future
343 system may take the conceptual place of smartmatch, but it has not yet
344 been designed or built.
345
346 These features will be entirely removed from perl in v5.42.0.
347
349 • Additional optree optimizations for common OP patterns. For
350 example, multiple simple OPs replaced by a single streamlined OP,
351 so as to be more efficient at runtime. [GH #19943
352 <https://github.com/Perl/perl5/pull/19943>], [GH #20063
353 <https://github.com/Perl/perl5/pull/20063>], [GH #20077
354 <https://github.com/Perl/perl5/pull/20077>].
355
356 • Creating an anonymous sub no longer generates an "srefgen" op, the
357 reference generation is now done in the "anoncode" or "anonconst"
358 op, saving runtime. [GH #20290
359 <https://github.com/Perl/perl5/pull/20290>]
360
362 Updated Modules and Pragmata
363 • Added the is_tainted() builtin function. [GH #19854
364 <https://github.com/Perl/perl5/issues/19854>]
365
366 • Added the export_lexically() builtin function as per PPC 0020
367 <https://github.com/Perl/PPCs/blob/main/ppcs/ppc0020-lexical-
368 export.md>. [GH #19895
369 <https://github.com/Perl/perl5/issues/19895>]
370
371 • Support for PPC 0018
372 <https://github.com/Perl/PPCs/blob/main/ppcs/ppc0018-module-
373 true.md>, "use feature "module_true";" has been added to the
374 default feature bundle for v5.38 and later. It may also be used
375 explicitly. When enabled inside of a module the module does not
376 need to return true explicitly, and in fact the return will be
377 forced to a simple true value regardless of what it originally was.
378
379 • Attribute::Handlers has been upgraded from version 1.02 to 1.03.
380
381 • attributes has been upgraded from version 0.34 to 0.35.
382
383 • autodie has been upgraded from version 2.34 to 2.36.
384
385 • B has been upgraded from version 1.83 to 1.88.
386
387 • B::Concise has been upgraded from version 1.006 to 1.007.
388
389 • B::Deparse has been upgraded from version 1.64 to 1.74.
390
391 • Benchmark has been upgraded from version 1.23 to 1.24.
392
393 • bignum has been upgraded from version 0.65 to 0.66.
394
395 • Carp has been upgraded from version 1.52 to 1.54.
396
397 • Class::Struct has been upgraded from version 0.66 to 0.68.
398
399 • Compress::Raw::Bzip2 has been upgraded from version 2.103 to
400 2.204_001.
401
402 • Compress::Raw::Zlib has been upgraded from version 2.105 to
403 2.204_001.
404
405 • Config::Perl::V has been upgraded from version 0.33 to 0.36.
406
407 • CPAN has been upgraded from version 2.33 to 2.36.
408
409 • Data::Dumper has been upgraded from version 2.184 to 2.188.
410
411 • DB_File has been upgraded from version 1.857 to 1.858.
412
413 • Devel::Peek has been upgraded from version 1.32 to 1.33.
414
415 • Devel::PPPort has been upgraded from version 3.68 to 3.71.
416
417 • Digest::MD5 has been upgraded from version 2.58 to 2.58_01.
418
419 • Digest::SHA has been upgraded from version 6.02 to 6.04.
420
421 • DynaLoader has been upgraded from version 1.52 to 1.54.
422
423 • Encode has been upgraded from version 3.17 to 3.19.
424
425 • encoding::warnings has been upgraded from version 0.13 to 0.14.
426
427 • Env has been upgraded from version 1.05 to 1.06.
428
429 • Errno has been upgraded from version 1.36 to 1.37.
430
431 • experimental has been upgraded from version 0.028 to 0.031.
432
433 • ExtUtils::CBuilder has been upgraded from version 0.280236 to
434 0.280238.
435
436 • ExtUtils::Install has been upgraded from version 2.20 to 2.22.
437
438 • ExtUtils::MakeMaker has been upgraded from version 7.64 to 7.70.
439
440 • ExtUtils::Miniperl has been upgraded from version 1.11 to 1.13.
441
442 • ExtUtils::ParseXS has been upgraded from version 3.45 to 3.51.
443
444 • ExtUtils::PL2Bat has been upgraded from version 0.004 to 0.005.
445
446 • ExtUtils::Typemaps has been upgraded from version 3.45 to 3.51.
447
448 • feature has been upgraded from version 1.72 to 1.82.
449
450 • File::Basename has been upgraded from version 2.85 to 2.86.
451
452 • File::Copy has been upgraded from version 2.39 to 2.41.
453
454 • File::Find has been upgraded from version 1.40 to 1.43.
455
456 • File::Glob has been upgraded from version 1.37 to 1.40.
457
458 • File::Spec has been upgraded from version 3.84 to 3.89.
459
460 • File::stat has been upgraded from version 1.12 to 1.13.
461
462 • FileHandle has been upgraded from version 2.03 to 2.05.
463
464 • Filter::Util::Call has been upgraded from version 1.60 to 1.64.
465
466 • GDBM_File has been upgraded from version 1.23 to 1.24.
467
468 • Getopt::Long has been upgraded from version 2.52 to 2.54.
469
470 • Hash::Util has been upgraded from version 0.28 to 0.30.
471
472 • HTTP::Tiny has been upgraded from version 0.080 to 0.083.
473
474 • I18N::Langinfo has been upgraded from version 0.21 to 0.22.
475
476 • IO has been upgraded from version 1.50 to 1.52.
477
478 • IO-Compress has been upgraded from version 2.106 to 2.204.
479
480 • IO::Socket::IP has been upgraded from version 0.41 to 0.41_01.
481
482 On DragonflyBSD, detect setsockopt() not actually clearing
483 "IPV6_V6ONLY" even when setsockopt() returns success. [cpan
484 #148293 <https://rt.cpan.org/Ticket/Display.html?id=148293>]
485
486 • IO::Zlib has been upgraded from version 1.11 to 1.14.
487
488 • JSON::PP has been upgraded from version 4.07 to 4.16.
489
490 • libnet has been upgraded from version 3.14 to 3.15.
491
492 • Locale::Maketext has been upgraded from version 1.31 to 1.33.
493
494 • Math::BigInt has been upgraded from version 1.999830 to 1.999837.
495
496 • Math::BigInt::FastCalc has been upgraded from version 0.5012 to
497 0.5013.
498
499 • Math::BigRat has been upgraded from version 0.2621 to 0.2624.
500
501 • Math::Complex has been upgraded from version 1.5902 to 1.62.
502
503 • Memoize has been upgraded from version 1.03_01 to 1.16.
504
505 • MIME::Base64 has been upgraded from version 3.16 to 3.16_01.
506
507 • Module::CoreList has been upgraded from version 5.20220520 to
508 5.20230520.
509
510 • mro has been upgraded from version 1.26 to 1.28.
511
512 • NDBM_File has been upgraded from version 1.15 to 1.16.
513
514 • Net::Ping has been upgraded from version 2.74 to 2.76.
515
516 • ODBM_File has been upgraded from version 1.17 to 1.18.
517
518 • Opcode has been upgraded from version 1.57 to 1.64.
519
520 • overload has been upgraded from version 1.35 to 1.37.
521
522 • parent has been upgraded from version 0.238 to 0.241.
523
524 • PerlIO::via::QuotedPrint has been upgraded from version 0.09 to
525 0.10.
526
527 • Pod::Checker has been upgraded from version 1.74 to 1.75.
528
529 • Pod::Html has been upgraded from version 1.33 to 1.34.
530
531 • Pod::Usage has been upgraded from version 2.01 to 2.03.
532
533 • podlators has been upgraded from version 4.14 to 5.01.
534
535 • POSIX has been upgraded from version 2.03 to 2.13.
536
537 • re has been upgraded from version 0.43 to 0.44.
538
539 • Safe has been upgraded from version 2.43 to 2.44.
540
541 • Scalar::Util has been upgraded from version 1.62 to 1.63.
542
543 • SDBM_File has been upgraded from version 1.15 to 1.17.
544
545 • Socket has been upgraded from version 2.033 to 2.036.
546
547 • Storable has been upgraded from version 3.26 to 3.32.
548
549 • Sys::Hostname has been upgraded from version 1.24 to 1.25.
550
551 • Term::Cap has been upgraded from version 1.17 to 1.18.
552
553 • Test::Simple has been upgraded from version 1.302190 to 1.302194.
554
555 • Text::Balanced has been upgraded from version 2.04 to 2.06.
556
557 • threads has been upgraded from version 2.27 to 2.36.
558
559 • threads::shared has been upgraded from version 1.64 to 1.68.
560
561 • Tie::File has been upgraded from version 1.06 to 1.07.
562
563 • Time::HiRes has been upgraded from version 1.9770 to 1.9775.
564
565 • Time::Piece has been upgraded from version 1.3401 to 1.3401_01.
566
567 • Unicode::Normalize has been upgraded from version 1.31 to 1.32.
568
569 • UNIVERSAL has been upgraded from version 1.14 to 1.15.
570
571 • User::grent has been upgraded from version 1.03 to 1.04.
572
573 • User::pwent has been upgraded from version 1.01 to 1.02.
574
575 • utf8 has been upgraded from version 1.24 to 1.25.
576
577 • warnings has been upgraded from version 1.58 to 1.65.
578
579 • XS::APItest has been upgraded from version 1.22 to 1.32.
580
581 • XSLoader has been upgraded from version 0.31 to 0.32.
582
584 New Documentation
585 perlclass
586
587 Describes the new "class" feature.
588
589 perlclassguts
590
591 Describes the internals of the new "class" feature.
592
593 Changes to Existing Documentation
594 We have attempted to update the documentation to reflect the changes
595 listed in this document. If you find any we have missed, open an issue
596 at <https://github.com/Perl/perl5/issues>.
597
598 Additionally, the following selected changes have been made:
599
600 perlapi
601
602 • Documented "hv_ksplit"
603
604 • Documented "hv_name_set"
605
606 • "hv_store" and "hv_stores" documentation have been greatly
607 improved.
608
609 • Documented "gv_autoload_pv"
610
611 • Documented "gv_autoload_pvn"
612
613 • Documented "gv_autoload_sv"
614
615 • Documented "gv_name_set"
616
617 • Documented "start_subparse"
618
619 • Documented "SV_CHECK_THINKFIRST_COW_DROP"
620
621 • Documented "SV_CHECK_THINKFIRST"
622
623 • Documented "SvPV_shrink_to_cur"
624
625 • Documented "save_aelem"
626
627 • Documented "save_aelem_flags"
628
629 • Documented "save_helem"
630
631 • Documented "save_helem_flags"
632
633 perldeprecation
634
635 • Added information about unscheduled deprecations and their
636 categories.
637
638 • Added category information for existing scheduled deprecations.
639
640 • Added smartmatch and apostrophe as a package separator deprecation
641 data.
642
643 perlintern
644
645 • Documented "save_pushptr"
646
647 • Documented "save_scalar_at"
648
649 • Entries have been added to perlguts for the new "newAV_alloc_x",
650 "newAV_alloc_xz" and *_simple functions.
651
652 • References to the now-defunct PrePAN service have been removed from
653 perlcommunity and perlmodstyle.
654
655 • A section on symbol naming has been added to perlhacktips.
656
657 • perlexperiment has been edited to properly reference the warning
658 categories for the defer block modifier and extra paired delimiters
659 for quote-like operators.
660
661 perlexperiment
662
663 • Smartmatch has been moved from experimental status to deprecated
664 status. Unfortunately the experiment did not work out.
665
666 perlfunc
667
668 • Some wording improvements have been made for the "ucfirst", "push",
669 "unshift" and "bless" functions, as well as additional examples
670 added.
671
672 perlhacktips
673
674 • A new section, "Writing safer macros" in perlhacktips has been
675 added to discuss pitfalls and solutions to using C macros in C and
676 XS code.
677
678 • A new section, "Choosing good symbol names" in perlhacktips, has
679 been added to discuss unexpected gotchas with names.
680
681 perlop
682
683 • Document the behavior of matching the empty pattern better and
684 specify its relationship to the new "${^LAST_SUCCESSFUL_PATTERN}"
685 properly.
686
687 perlvar
688
689 • Added a section on "Scoping Rules of Regex Variables", and other
690 wording improvements made throughout.
691
692 • Added information on the new "%{^HOOK}" interface, and the new
693 "require__before" and "require__after" hooks which it exposes.
694
695 • Correct information on the regex variables "${^PREMATCH}",
696 "${^MATCH}" and "${^POSTMATCH}", all of which were incorrectly
697 documented due to an oversight. Specifically they only work
698 properly after a regex operation that used the /p modifier to
699 enable them.
700
701 • Added information on the new regex variable
702 "${^LAST_SUCCESSFUL_PATTERN}", which represents the pattern of the
703 last successful regex match in scope.
704
706 The following additions or changes have been made to diagnostic output,
707 including warnings and fatal error messages. For the complete list of
708 diagnostic messages, see perldiag.
709
710 New Diagnostics
711 New Errors
712
713 • A new syntax error has been added for the error that a "catch"
714 block does not have its required variable declaration. See catch
715 block requires a (VAR)
716
717 • Too many nested BEGIN blocks, maximum of %d allowed
718
719 • Execution of %s aborted due to compilation errors.
720
721 • Can't locate object method "INC", nor "INCDIR" nor string overload
722 via package "%s" %s in @INC
723
724 • Attempt to bless into a class
725
726 (F) You are attempting to call "bless" with a package name that is
727 a new-style "class". This is not necessary, as instances created
728 by the constructor are already in the correct class. Instances
729 cannot be created by other means, such as "bless".
730
731 • Cannot assign :param(%s) to field %s because that name is already
732 in use
733
734 (F) An attempt was made to apply a parameter name to a field, when
735 the name is already being used by another field in the same class,
736 or one of its parent classes. This would cause a name clash so is
737 not allowed.
738
739 • Cannot create class %s as it already has a non-empty @ISA
740
741 (F) An attempt was made to create a class out of a package that
742 already has an @ISA array, and the array is not empty. This is not
743 permitted, as it would lead to a class with inconsistent
744 inheritance.
745
746 • Cannot invoke a method of "%s" on an instance of "%s"
747
748 (F) You tried to directly call a "method" subroutine of one class
749 by passing in a value that is an instance of a different class.
750 This is not permitted, as the method would not have access to the
751 correct instance fields.
752
753 • Cannot invoke method on a non-instance
754
755 (F) You tried to directly call a "method" subroutine of a class by
756 passing in a value that is not an instance of that class. This is
757 not permitted, as the method would not then have access to its
758 instance fields.
759
760 • Cannot '%s' outside of a 'class'
761
762 (F) You attempted to use one of the keywords that only makes sense
763 inside a "class" definition, at a location that is not inside such
764 a class.
765
766 • Cannot reopen existing class "%s"
767
768 (F) You tried to begin a "class" definition for a class that
769 already exists. A class may only have one definition block.
770
771 • Can't bless an object reference
772
773 (F) You attempted to call "bless" on a value that already refers to
774 a real object instance.
775
776 • can't convert empty path
777
778 (F) On Cygwin, you called a path conversion function with an empty
779 path. Only non-empty paths are legal.
780
781 • Class already has a superclass, cannot add another
782
783 (F) You attempted to specify a second superclass for a "class" by
784 using the ":isa" attribute, when one is already specified. Unlike
785 classes whose instances are created with "bless", classes created
786 via the "class" keyword cannot have more than one superclass.
787
788 • Class attribute %s requires a value
789
790 (F) You specified an attribute for a class that would require a
791 value to be passed in parentheses, but did not provide one.
792 Remember that whitespace is not permitted between the attribute
793 name and its value; you must write this as
794
795 class Example::Class :attr(VALUE) ...
796
797 • Class :isa attribute requires a class but "%s" is not one
798
799 (F) When creating a subclass using the "class" ":isa" attribute,
800 the named superclass must also be a real class created using the
801 "class" keyword.
802
803 • Field already has a parameter name, cannot add another
804
805 (F) A field may have at most one application of the ":param"
806 attribute to assign a parameter name to it; once applied a second
807 one is not allowed.
808
809 • Field attribute %s requires a value
810
811 (F) You specified an attribute for a field that would require a
812 value to be passed in parentheses, but did not provide one.
813 Remember that whitespace is not permitted between the attribute
814 name and its value; you must write this as
815
816 field $var :attr(VALUE) ...
817
818 • Field %s is not accessible outside a method
819
820 (F) An attempt was made to access a field variable of a class from
821 code that does not appear inside the body of a "method" subroutine.
822 This is not permitted, as only methods will have access to the
823 fields of an instance.
824
825 • Field %s of "%s" is not accessible in a method of "%s"
826
827 (F) An attempt was made to access a field variable of a class, from
828 a method of another class nested inside the one that actually
829 defined it. This is not permitted, as only methods defined by a
830 given class are permitted to access fields of that class.
831
832 • Only scalar fields can take a :param attribute
833
834 (F) You tried to apply the ":param" attribute to an array or hash
835 field. Currently this is not permitted.
836
837 • Required parameter '%s' is missing for %s constructor
838
839 (F) You called the constructor for a class that has a required
840 named parameter, but did not pass that parameter at all.
841
842 • Unexpected characters while parsing class :isa attribute: %s
843
844 (F) You tried to specify something other than a single class name
845 with an optional trailing version number as the value for a "class"
846 ":isa" attribute. This confused the parser.
847
848 • Unrecognized class attribute %s
849
850 (F) You attempted to add a named attribute to a "class" definition,
851 but perl does not recognise the name of the requested attribute.
852
853 • Unrecognized field attribute %s
854
855 (F) You attempted to add a named attribute to a "field" definition,
856 but perl does not recognise the name of the requested attribute.
857
858 • ${^HOOK}{%s} may only be a CODE reference or undef
859
860 • Attempt to set unknown hook '%s' in %{^HOOK}
861
862 • Missing or undefined argument to %s via %{^HOOK}{require__before}
863
864 • Too many capture groups (limit is %d) in regex m/%s/
865
866 New Warnings
867
868 • Unknown locale category %d
869
870 This is a shortened form of an already existing diagnostic, for use
871 when there is no new locale being switched to. The previous
872 diagnostic was misleading in such circumstances.
873
874 • Locale '%s' is unsupported, and may crash the interpreter.
875
876 • Treating %s::INIT block as BEGIN block as workaround
877
878 • Filehandle STD%s reopened as %s only for input
879
880 • %s on BEGIN block ignored
881
882 • ADJUST is experimental
883
884 (S experimental::class) This warning is emitted if you use the
885 "ADJUST" keyword of "use feature 'class'". This keyword is
886 currently experimental and its behaviour may change in future
887 releases of Perl.
888
889 • class is experimental
890
891 (S experimental::class) This warning is emitted if you use the
892 "class" keyword of "use feature 'class'". This keyword is
893 currently experimental and its behaviour may change in future
894 releases of Perl.
895
896 • Method %s redefined
897
898 (W redefine) You redefined a method. To suppress this warning, say
899
900 {
901 no warnings 'redefine';
902 *name = method { ... };
903 }
904
905 • Odd number of elements in hash field initialization
906
907 (W misc) You specified an odd number of elements to initialise a
908 hash field of an object. Hashes are initialised from a list of
909 key/value pairs so there must be a corresponding value to every
910 key. The final missing value will be filled in with undef instead.
911
912 • Old package separator "'" deprecated
913
914 (W deprecated, syntax) You used the old package separator "'" in a
915 variable, subroutine or package name. Support for the old package
916 separator will be removed in Perl 5.40.
917
918 • field is experimental
919
920 (S experimental::class) This warning is emitted if you use the
921 "field" keyword of "use feature 'class'". This keyword is
922 currently experimental and its behaviour may change in future
923 releases of Perl.
924
925 • method is experimental
926
927 (S experimental::class) This warning is emitted if you use the
928 "method" keyword of "use feature 'class'". This keyword is
929 currently experimental and its behaviour may change in future
930 releases of Perl.
931
932 • Can't call destructor for 0x%p in global destruction
933
934 Changes to Existing Diagnostics
935 • The compiler will now stop parsing on the first syntax error it
936 encounters. Historically the compiler would attempt to "skip past"
937 the error and continue parsing so that it could list multiple
938 errors. For things like undeclared variables under strict this
939 makes sense. For syntax errors however it has been found that
940 continuing tends to result in a storm of unrelated or bizarre
941 errors that mostly just obscure the true error. In extreme cases it
942 can even lead to segfaults and other incorrect behavior.
943
944 Therefore we have reformed the continuation logic so that the parse
945 will stop after the first seen syntax error. Semantic errors like
946 undeclared variables will not stop the parse, so you may still see
947 multiple errors when compiling code. However if there is a syntax
948 error it will be the last error message reported by perl and all of
949 the errors that you see will be something that actually needs to be
950 fixed.
951
952 • Error messages that output class or package names have been
953 modified to output double quoted strings with various characters
954 escaped so as to make the exact value clear to a reader. The exact
955 rules on which characters are escaped may change over time but
956 currently are that printable ASCII codepoints, with the exception
957 of """ and "\", and unicode word characters whose codepoint is over
958 255 are output raw, and any other symbols are escaped much as
959 Data::Dumper might escape them, using "\n" for newline and "\"" for
960 double quotes, etc. Codepoints in the range 128-255 are always
961 escaped as they can cause trouble on unicode terminals when output
962 raw.
963
964 In older versions of perl the one liner
965
966 $ perl -le'"thing\n"->foo()'
967
968 would output the following error message exactly as shown here,
969 with text spread over multiple lines because the "\n" would be
970 emitted as a raw newline character:
971
972 Can't locate object method "foo" via package "thing
973 " (perhaps you forgot to load "thing
974 "?) at -e line 1.
975
976 As of this release we would output this instead (as one line):
977
978 Can't locate object method "foo" via package "thing\n"
979 (perhaps you forgot to load "thing\n"?) at -e line 1.
980
981 Notice the newline in the package name has been quoted and escaped,
982 and thus the error message is a single line. The text is shown here
983 wrapped to two lines only for readability.
984
985 • When package or class names in errors are very large the middle
986 excess portion will be elided from the message. As of this release
987 error messages will show only up to the first 128 characters and
988 the last 128 characters in a package or class name in error
989 messages. For example
990
991 $ perl -le'("Foo" x 1000)->new()'
992
993 will output the following as one line:
994
995 Can't locate object method "new" via package "FooFooFooFooFooFooFoo
996 FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
997 FooFooFooFooFooFooFooFooFooFooFooFooFooFo"..."oFooFooFooFooFooFooFoo
998 FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
999 FooFooFooFooFooFooFooFooFooFooFooFooFoo" (perhaps you forgot to load
1000 "FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
1001 FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFo"...
1002 "oFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
1003 FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo"?)
1004 at -e line 1.
1005
1006 Notice the "prefix"..."suffix" form of the package name in this
1007 case. In previous versions of perl the complete string would have
1008 been shown making the error message over 6k long and there was no
1009 upper limit on the length of the error message at all. If you
1010 accidentally used a 1MB string as a class name then the error
1011 message would be over 2MB long. In this perl the upper limit should
1012 be around 2k when eliding and escaping are taken into account.
1013
1014 • Removed "Complex regular subexpression recursion limit (%d)
1015 exceeded"
1016
1017 The regular expresion engine has not used recursion in some time.
1018 This warning no longer makes sense.
1019
1020 See [GH #19636 <https://github.com/Perl/perl5/pull/19636>].
1021
1022 • Various warnings that used to produce parenthesized hints
1023 underneath the main warning message and after its "location data"
1024 were chanaged to put the hint inline with the main message. For
1025 instance:
1026
1027 Bareword found where operator expected at -e line 1, near "foo bar"
1028 (Do you need to predeclare foo?)
1029
1030 will now look like this but as one line:
1031
1032 Bareword found where operator expected (Do you need to predeclare
1033 foo?) at -e line 1, near "foo bar"
1034
1035 as a result such warnings will no longer trigger $SIG{__WARN__}
1036 twice, and the hint will be visible when fatal warnings is in
1037 effect.
1038
1039 • The error message that is produced when a "require" or "use"
1040 statement fails has been changed. It used to contain the words
1041 "@INC contains:", and it used to show the state of @INC *after* the
1042 require had completed and failed. The error message has been
1043 changed to say "@INC entries checked:" and to reflect the actual
1044 directories or hooks that were executed during the require
1045 statement. For example:
1046
1047 perl -e'push @INC, sub {@INC=()}; eval "require Frobnitz"
1048 or die $@'
1049 Can't locate Frobnitz.pm in @INC (you may need to install the
1050 Frobnitz module) (@INC contains:) at (eval 1) line 1.
1051
1052 Will change to (with some output elided for clarity):
1053
1054 perl -e'push @INC, sub {@INC=()}; eval "require Frobnitz"
1055 or die $@'
1056 Can't locate Frobnitz.pm in @INC (you may need to install the
1057 Frobnitz module) (@INC entries checked:
1058 .../site_perl/5.38.0/x86_64-linux .../site_perl/5.38.0
1059 .../5.38.0/x86_64-linux .../5.38.0 CODE(0x562745e684b8))
1060 at (eval 1) line 1.
1061
1062 thus showing the actual directories checked. Code that checks for
1063 "@INC contains:" in error messages should be hardened against any
1064 future wording changes between the @INC and ":", for instance use
1065 "qr/\@INC[ \w]+:/" instead of using "qr/\@INC contains:/" or
1066 "qr/\@INC entries checked:/" in tests as this will ensure both
1067 forward and backward compatibility.
1068
1069 • Old package separator used in string
1070
1071 This diagnostic is now also part of the "deprecated" category.
1072
1073 • given is deprecated replaces "given is experimental".
1074
1075 • when is deprecated replaces "when is experimental".
1076
1077 • Smartmatch is deprecated replaces "Smartmatch is experimental".
1078
1080 • "make -j6 minitest" could fail due to a build conflict in building
1081 "$(MINIPERL_EXE)" between the main make process and a child
1082 process. [GH #19829 <https://github.com/Perl/perl5/issues/19829>]
1083
1084 • Properly populate osvers on Dragonfly BSD when the hostname isn't
1085 set.
1086
1087 • Fix typos for C99 macro name "PRIX64".
1088
1089 • Remove ancient and broken GCC for VMS support
1090
1091 • Remove vestigial reference to "/VAXC" qualifier
1092
1093 • Remove sharedperl option on VMS
1094
1095 • VMS now has mkostemp
1096
1097 • "Configure" now properly handles quoted elements outputted by gcc.
1098 [GH #20606 <https://github.com/Perl/perl5/issues/20606>]
1099
1100 • "Configure" probed for the return type of malloc() and free() by
1101 testing whether declarations for those functions produced a
1102 function type mismatch with the implementation. On Solaris, with a
1103 C++ compiler, this check always failed, since Solaris instead
1104 imports malloc() and free() from "std::" with "using" for C++
1105 builds. Since the return types of malloc() and free() are well
1106 defined by the C standard, skip probing for them. "Configure"
1107 command-line arguments and hints can still override these type in
1108 the unlikely case that is needed. [GH #20806
1109 <https://github.com/Perl/perl5/issues/20806>]
1110
1112 Tests were added and changed to reflect the other additions and changes
1113 in this release. Furthermore, these significant changes were made:
1114
1115 • Unicode normalization tests have been added.
1116
1117 • t/test.pl: Add ability to cancel an watchdog timer
1118
1120 Discontinued Platforms
1121 Ultrix
1122 Support code for DEC Ultrix has been removed. Ultrix was the
1123 native Unix-like operating system for various Digital Equipment
1124 Corporation machines. Its final release was in 1995.
1125
1126 Platform-Specific Notes
1127 DragonflyBSD
1128 Skip tests to workaround an apparent bug in setproctitle(). [GH
1129 #19894 <https://github.com/Perl/perl5/issues/19894>]
1130
1131 FreeBSD
1132 FreeBSD no longer uses thread-safe locale operations, to avoid a
1133 bug in FreeBSD
1134 <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265950>
1135
1136 Replace the first part of archname with "uname -p" [GH #19791
1137 <https://github.com/Perl/perl5/issues/19791>]
1138
1139 Solaris
1140 Avoid some compiler and compilation issues on NetBSD/Solaris from
1141 regexec.c and regcomp.c.
1142
1143 Synology
1144 Update Synology Readme for DSM 7.
1145
1146 Windows
1147 Fix win32 memory alignment needed for gcc-12 from vmem.h.
1148
1149 utimes() on Win32 would print a message to stderr if it failed to
1150 convert a supplied "time_t" to to a "FILETIME". [GH #19668
1151 <https://github.com/Perl/perl5/issues/19668>]
1152
1153 In some cases, timestamps returned by stat() and lstat() failed to
1154 take daylight saving time into account. [GH #20018
1155 <https://github.com/Perl/perl5/issues/20018>] [GH #20061
1156 <https://github.com/Perl/perl5/issues/20061>]
1157
1158 stat() now works on "AF_UNIX" socket files. [GH #20204
1159 <https://github.com/Perl/perl5/issues/20204>]
1160
1161 readlink() now returns the "PrintName" from a symbolic link reparse
1162 point instead of the "SubstituteName", which should make it better
1163 match the name the link was created with. [GH #20271
1164 <https://github.com/Perl/perl5/pull/20271>]
1165
1166 lstat() on Windows now returns the length of the link target as the
1167 size of the file, as it does on POSIX systems. [GH #20476
1168 <https://github.com/Perl/perl5/issues/20476>]
1169
1170 symlink() on Windows now replaces any "/" in the target with "\",
1171 since Windows does not recognise "/" in symbolic links. The
1172 reverse translation is not done by readlink(). [GH #20506
1173 <https://github.com/Perl/perl5/issues/20506>]
1174
1175 symlink() where the target was an absolute path to a directory was
1176 incorrectly created as a file symbolic link. [GH #20533
1177 <https://github.com/Perl/perl5/issues/20533>]
1178
1179 "POSIX::dup2" no longer creates broken sockets. [GH #20920
1180 <https://github.com/Perl/perl5/issues/20920>]
1181
1182 Closing a busy pipe could cause Perl to hang. [GH #19963
1183 <https://github.com/Perl/perl5/issues/19963>]
1184
1186 • Removed many deprecated C functions.
1187
1188 These have been deprecated for a long time. See
1189 <https://github.com/perl/perl5/commit/7008caa915ad99e650acf2aea40612b5e48b7ba2>
1190 for a full list.
1191
1192 • "get_op_descs", "get_op_names", "get_opargs", "get_no_modify" and
1193 "get_ppaddr" have been marked deprecated.
1194
1195 • "hv_free_ent" has been marked as internal API.
1196
1197 • "save_pushptr", "save_pushptrptr", and "save_pushi32ptr" have been
1198 marked as internal API.
1199
1200 • New bool related functions and macros have been added to complement
1201 the new bool type introduced in 5.36:
1202
1203 The functions are:
1204
1205 "newSVbool(const bool bool_val)"
1206 newSV_true()
1207 newSV_false()
1208 "sv_set_true(SV *sv)"
1209 "sv_set_false(SV *sv)"
1210 "sv_set_bool(SV *sv, const bool bool_val)"
1211
1212 The macros are:
1213
1214 SvIandPOK(sv)
1215 SvIandPOK_off(sv)
1216 "SvIandPOK_on"
1217 • Perl is no longer manipulating the "environ" array directly. The
1218 variable "PL_use_safe_putenv" has been removed and
1219 "PERL_USE_SAFE_PUTENV" is always defined. This means XS modules can
1220 now call "setenv" and "putenv" without causing segfaults. [perl
1221 #19399 <https://github.com/Perl/perl5/issues/19399>]
1222
1223 • Internal C API functions are now hidden with
1224 "__attribute__((hidden))" on the platforms that support it. This
1225 means they are no longer callable from XS modules on those
1226 platforms.
1227
1228 It should be noted that those functions have always been hidden on
1229 Windows. This change merely brings that to the other platforms.
1230 [perl #19655 <https://github.com/Perl/perl5/pull/19655>]
1231
1232 • New formatting symbols were added for printing values declared as
1233 "U32" or "I32":
1234
1235 I32df -- Like %d
1236 U32of -- Like %o
1237 U32uf -- Like %u
1238 U32xf -- Like %x
1239 U32Xf -- Like %X
1240
1241 These are used in the same way already existing similar symbols,
1242 such as "IVdf", are used. See "I/O Formats" in perlapi.
1243
1244 • new 'HvHasAUX' macro
1245
1246 • regexec.c: Add some branch predictions reorder conds
1247
1248 • locale: Change macro name to be C conformant
1249
1250 • Rename the "PADNAMEt_*" constants to "PADNAMEf_*"
1251
1252 • Changes all the API macros that retrieve a PV into a call to an
1253 inline function so as to evaluate the parameter just once.
1254
1255 • regexec.c: multiple code refactor to make the code more readable
1256
1257 • perl.h: Change macro name to be C conformant (remove leading _ from
1258 NOT_IN_NUMERIC macros)
1259
1260 • regcomp.h: add new "BITMAP_BIT" macro in addition to the existing
1261 "BITMAP_BYTE" and "BITMAP_TEST" ones.
1262
1263 • Create new regnode type ANYOFH. populate_ANYOF_from_invlist was
1264 renamed to populate_bitmap_from_invlist
1265
1266 • regex: Refactor bitmap vs non-bitmap of qr/[]/
1267
1268 • regcomp.c: add new functions to convert from an inversion list to a
1269 bitmap (and vice versa) "populate_bitmap_from_invlist" and
1270 "populate_invlist_from_bitmap".
1271
1272 • Add newAVav() to create an AV from an existing AV. Add newAVhv()
1273 to create an AV using keys and values from an existing HV.
1274
1275 • Fix definition of "Perl_atof".
1276
1277 • Fix undefined behavior with overflow related "OPTIMIZE_INFTY" and
1278 delta in regcomp.c.
1279
1280 • Fix regnode pointer alignment issue in regcomp.h.
1281
1282 • The "CVf_METHOD" CV flag and associated "CvMETHOD" macro has been
1283 renamed to "CVf_NOWARN_AMBIGUOUS" and "CvNOWARN_AMBIGUOUS". This
1284 closer reflects its actual behaviour (it suppresses a warning that
1285 would otherwise be generated about ambiguous names), in order to be
1286 less confusing with "CvIsMETHOD", which indicates that a CV is a
1287 "method" subroutine relating to the "class" feature.
1288
1289 • The "OPf_SPECIAL" flag is no longer set on the "OP_ENTERSUB" op
1290 constructed to call the "VERSION", "import" and "unimport" methods
1291 as part of a "use" statement and attribute application, nor when
1292 assigning to an ":lvalue" subroutine.
1293
1294 • A new CV flag "CVf_REFCOUNTED_ANYSV" has been added, which
1295 indicates that the CV is an XSUB and stores an SV pointer in the
1296 "CvXSUBANY.any_sv" union field. Perl core operations such as
1297 cloning or destroying the CV will maintain the reference count of
1298 the pointed-to SV, destroying it when required.
1299
1300 • A new API function ""Perl_localeconv"" in perlapi is added. This
1301 is the same as "POSIX::localeconv" (returning a hash of the
1302 localeconv() fields), but directly callable from XS code.
1303
1304 • A new API function, ""Perl_langinfo8"" in perlapi is added. This
1305 is the same as plain ""Perl_langinfo"" in perlapi, but with an
1306 extra parameter that allows the caller to simply and reliably know
1307 if the returned string is UTF-8.
1308
1309 • We have introduced a limit on the number of nested "eval
1310 EXPR"/"BEGIN" blocks and "require"/"BEGIN" (and thus "use"
1311 statements as well) to prevent C stack overflows. This variable can
1312 also be used to forbid "BEGIN" blocks from executing during "eval
1313 EXPR" compilation. The limit defaults to 1000 but can be overridden
1314 by setting the "${^MAX_NESTED_EVAL_BEGIN_BLOCKS}" variable. The
1315 default itself can be changed at compile time with
1316
1317 -Accflags='-DPERL_MAX_NESTED_EVAL_BEGIN_BLOCKS_DEFAULT=12345'
1318
1319 Note that this value relates to the size of your C stack and if you
1320 choose an inappropriately large value Perl may segfault, be
1321 conservative about what you choose.
1322
1323 • A new magic type "PERL_MAGIC_extvalue" has been added. This is
1324 available for use like "PERL_MAGIC_ext", but is a value magic: upon
1325 localization the new value will not be magical.
1326
1327 • The SSNEW(), SSNEWt(), SSNEWa() and SSNEWat() APIs now return a
1328 "SSize_t" value. The SSPTR() and SSPTRt() macros now expect a
1329 "SSize_t" parameter, and enforce that on debugging builds. [GH
1330 #20411 <https://github.com/Perl/perl5/issues/20411>]
1331
1332 • Filenames in cops are now refcounted under threads. Under threads
1333 we were copying the filenames into each opcode. This is because in
1334 theory opcodes created in one thread can be destroyed in another.
1335 The change adds a new struct/type "RCPV", which is a refcounted
1336 string using shared memory. This is implemented in such a way that
1337 code that previously used a char * can continue to do so, as the
1338 refcounting data is located a specific offset before the char *
1339 pointer itself.
1340
1341 • Added "HvNAMEf" and "HvNAMEf_QUOTEDPREFIX" special formats. They
1342 take an "HV *" as an argument and use HvNAME() and related macros
1343 to determine the string, its length, and whether it is utf8.
1344
1345 • The underlying "Perl_dowantarray" function implementing the long-
1346 deprecated "GIMME" macro has been marked as deprecated, so that use
1347 of the macro emits a compile-time warning. "GIMME" has been
1348 documented as deprecated in favour of "GIMME_V" since Perl v5.6.0,
1349 but had not previously issued a warning.
1350
1351 • The API function "utf8_length" in perlapi is now more efficient.
1352
1353 • Added SAVERCPV() and SAVEFREERCPV() for better support for working
1354 with "RCPV" (reference counted string/pointer value) structures
1355 which currently are used in opcodes to share filename and warning
1356 bit data in a memory efficient manner.
1357
1358 • Added MORTALSVFUNC_SV() and MORTALDESTRUCTOR_SV() macros, which
1359 make it possible to create a destructor which is fired at the end
1360 of the current statement. This uses the "PERL_MAGIC_destruct" magic
1361 to use "free" magic to trigger an action when a variable is freed.
1362 The action can be specified as a C function or as a Perl code
1363 reference.
1364
1365 • Added the "%{^HOOK}" api and related "PERL_MAGIC_hook" and
1366 "PERL_MAGIC_hookelem" for providing ways to hook selected perl
1367 functions which for one reason or another are problematic to wrap
1368 with a customized subroutine.
1369
1370 • Added support for "${^HOOK}{require__before}" which can be used to
1371 rewrite the filename that "require" will try to load, and also to
1372 block "require" from loading a specific module, even via fully
1373 qualified filename. The hook can also be used to perform "pre-
1374 require" and "post-require" actions.
1375
1376 • Added support for "${^HOOK}{require__after}" which can be used to
1377 track what modules have been required after the fact.
1378
1379 • Regular expression opcodes (regops) now use a standardized
1380 structure layout that uses unions to expose data in different
1381 format. This means it should be much easier to extend or modify
1382 regops to use more memory. This has been used to make a number of
1383 regops track how many parens they contain.
1384
1386 • Avoid recursion and stack overflow parsing 'pack' template
1387
1388 [GH #16319 <https://github.com/Perl/perl5/issues/16319>]
1389
1390 • An eval() as the last statement in a regex code block could trigger
1391 an interpreter panic; e.g.
1392
1393 /(?{ ...; eval {....}; })/
1394
1395 [GH #19680 <https://github.com/Perl/perl5/issues/19680>]
1396
1397 • Disabling the "bareword_filehandles" feature no longer treats
1398 "print Class->method" as an error. [GH #19704
1399 <https://github.com/Perl/perl5/issues/19704>]
1400
1401 • When a Perl subroutine tail-calls an XS subroutine using "goto
1402 &xs_sub", the XS subroutine can now correctly determine its calling
1403 context. Previously it was always reported as scalar.
1404
1405 In addition, where the Perl subroutine is freed at the same time:
1406
1407 sub foo { *foo = sub {}; goto &xs_sub }
1408
1409 this formerly could lead to crashes if the XS subroutine tried to
1410 use the value of "PL_op", since this was being set to NULL. This is
1411 now fixed.
1412
1413 [GH #19936 <https://github.com/Perl/perl5/issues/19936>]
1414
1415 • setsockopt() now uses the mechanism added in 5.36 to better
1416 distinguish between numeric and string values supplied as the
1417 "OPTVAL" parameter. [GH #18761
1418 <https://github.com/Perl/perl5/issues/18761>]
1419
1420 • 4-argument select() now rejects strings with code points above 255.
1421 Additionally, for code points 128-255, this operator will now
1422 always give the corresponding octet to the OS, regardless of how
1423 Perl stores such code points in memory. (Previously Perl leaked its
1424 internal string storage to the OS.) [GH #19882
1425 <https://github.com/Perl/perl5/issues/19882>]
1426
1427 • Fix panic issue from "val {} inside /(?{...})/" [GH #19390
1428 <https://github.com/Perl/perl5/issues/19390>]
1429
1430 • Fix multiple compiler warnings from regexp.c, locale.c [GH #19915
1431 <https://github.com/Perl/perl5/issues/19915>]
1432
1433 • Fix a bug with querying locales on platforms that don't have
1434 "LC_NUMERIC" [GH #19890
1435 <https://github.com/Perl/perl5/issues/19890>]
1436
1437 • Prevent undefined behaviour in S_maybe_multideref().
1438
1439 • Avoid signed integer overflow in "use integer" ops.
1440
1441 • Avoid adding an offset to a NULL pointer in "hv_delete_common".
1442
1443 • PerlIO::get_layers will now accept IO references too
1444
1445 Previously it would only take glob references or names of globs.
1446 Now it will also accept IO references.
1447
1448 • Fixes to memory handling for "PL_splitstr":
1449
1450 • If a thread was created the allocated string would be freed
1451 twice.
1452
1453 • If two "-F" switches were supplied the memory allocated for the
1454 first switch wouldn't be freed.
1455
1456 • Correctly handle "OP_ANONCODE" ops generated by CPAN modules that
1457 don't include the OPf_REF flag when propagating lvalue context.
1458 [GH #20532 <https://github.com/Perl/perl5/pull/20532>]
1459
1460 • POSIX::strxfrm now uses the "LC_CTYPE" locale category to specify
1461 its collation, ignoring any differing "LC_COLLATE". It doesn't
1462 make sense for a string to be encoded in one locale (say,
1463 ISO-8859-6, Arabic) and to collate it based on another (like
1464 ISO-8859-7, Greek). Perl assumes that the current "LC_CTYPE"
1465 locale correctly represents the encoding, and collates accordingly.
1466
1467 Also, embedded "NUL" characters are now allowed in the input.
1468
1469 If locale collation is not enabled on the platform ("LC_COLLATE"),
1470 the input is returned unchanged.
1471
1472 • Double FETCH during stringification of tied scalars returning an
1473 overloaded object have been fixed. The FETCH method should only be
1474 called once, but prior to this release was actually called twice.
1475 [GH #20574 <https://github.com/Perl/perl5/pull/20574>]
1476
1477 • Writing to a magic variables associated with the selected output
1478 handle, $^, $~, $=, "$-" and $%, no longer crashes perl if the IO
1479 object has been cleared from the selected output handle. [GH #20733
1480 <https://github.com/Perl/perl5/issues/20733>]
1481
1482 • Redefining a "use constant" list constant with "use constant" now
1483 properly warns. This changes the behaviour of "use constant" but
1484 is a core change, not a change to constant.pm. [GH #20742
1485 <https://github.com/Perl/perl5/issues/20742>]
1486
1487 • Redefining a "use constant" list constant with an empty prototype
1488 constant sub would result in an assertion failure. [GH #20742
1489 <https://github.com/Perl/perl5/issues/20742>]
1490
1491 • Fixed a regression where the "INC" method for objects in @INC would
1492 not be resolved by "AUTOLOAD", while it was in 5.36. The "INCDIR"
1493 method for objects in @INC cannot be resolved by "AUTOLOAD" as
1494 "INC" would have been resolved first. [GH #20665
1495 <https://github.com/Perl/perl5/issues/20665>]
1496
1497 • $SIG{__DIE__} will now be called from eval when the code dies
1498 during compilation regardless of how it dies. This means that code
1499 expecting to be able to upgrade $@ into an object will be called
1500 consistently. In earlier versions of perl $SIG{__DIE__} would not
1501 be called for certain compilation errors, for instance undeclared
1502 variables. For other errors it might be called if there were more
1503 than a certain number of errors, but not if there were less. Now
1504 you can expect that it will be called in every case.
1505
1506 • Compilation of code with errors used to inconsistently stop
1507 depending on the count and type of errors encountered. The intent
1508 was that after 10 errors compilation would halt, but bugs in this
1509 logic meant that certain types of error would be counted, but would
1510 not trigger the threshold check to stop compilation. Other errors
1511 would. With this release after at most 10 errors compilation will
1512 terminate, regardless of what type of error they were.
1513
1514 Note that you can change the maximum count by defining
1515 "PERL_STOP_PARSING_AFTER_N_ERRORS" to be something else during the
1516 configuration process. For instance
1517
1518 ./Configure ... -Accflags='-DPERL_STOP_PARSING_AFTER_N_ERRORS=100'
1519
1520 would allow up to 100 errors.
1521
1522 • The API function "my_snprintf" in perlapi now prints a non-dot
1523 decimal point if the perl code it ultimately is called from is in
1524 the scope of "use locale" and the locale in effect calls for that.
1525
1526 • A number of bugs related to capture groups in quantified groups in
1527 regular expression have been fixed, especially in alternations. For
1528 example in a pattern like:
1529
1530 "foobazfoobar" =~ /((foo)baz|foo(bar))+/
1531
1532 the regex variable $2 will not be "foo" as it once was, it will be
1533 undef.
1534
1535 • Bugs with regex backreference operators that are inside of a
1536 capture group have been fixed. For instance:
1537
1538 "xa=xaaa" =~ /^(xa|=?\1a){2}\z/
1539
1540 will now correctly not match. [GH #10073
1541 <https://github.com/Perl/perl5/issues/10073>]
1542
1543 • SSGROW() and SSCHECK() have been reworked to ensure that the
1544 requested space is actually allocated. SSCHECK() is now an alias
1545 for SSGROW().
1546
1548 Perl 5.38.0 represents approximately 12 months of development since
1549 Perl 5.36.0 and contains approximately 290,000 lines of changes across
1550 1,500 files from 100 authors.
1551
1552 Excluding auto-generated files, documentation and release tools, there
1553 were approximately 190,000 lines of changes to 970 .pm, .t, .c and .h
1554 files.
1555
1556 Perl continues to flourish into its fourth decade thanks to a vibrant
1557 community of users and developers. The following people are known to
1558 have contributed the improvements that became Perl 5.38.0:
1559
1560 Alex, Alexander Nikolov, Alex Davies, Andreas König, Andrew Fresh,
1561 Andrew Ruthven, Andy Lester, Aristotle Pagaltzis, Arne Johannessen, A.
1562 Sinan Unur, Bartosz Jarzyna, Bart Van Assche, Benjamin Smith, Bram,
1563 Branislav Zahradník, Brian Greenfield, Bruce Gray, Chad Granum, Chris
1564 'BinGOs' Williams, chromatic, Clemens Wasser, Craig A. Berry, Dagfinn
1565 Ilmari Mannsåker, Dan Book, danielnachun, Dan Jacobson, Dan Kogai,
1566 David Cantrell, David Golden, David Mitchell, E. Choroba, Ed J, Ed
1567 Sabol, Elvin Aslanov, Eric Herman, Felipe Gasper, Ferenc Erki, Firas
1568 Khalil Khana, Florian Weimer, Graham Knop, Håkon Hægland, Harald Jörg,
1569 H.Merijn Brand, Hugo van der Sanden, James E Keenan, James Raspass,
1570 jkahrman, Joe McMahon, Johan Vromans, Jonathan Stowe, Jon Gentle, Karen
1571 Etheridge, Karl Williamson, Kenichi Ishigaki, Kenneth Ölwing, Kurt
1572 Fitzner, Leon Timmermans, Li Linjie, Loren Merritt, Lukas Mai, Marcel
1573 Telka, Mark Jason Dominus, Mark Shelor, Matthew Horsfall, Matthew O.
1574 Persico, Mattia Barbon, Max Maischein, Mohammad S Anwar, Nathan Mills,
1575 Neil Bowers, Nicholas Clark, Nicolas Mendoza, Nicolas R, Paul Evans,
1576 Paul Marquess, Peter John Acklam, Peter Levine, Philippe Bruhat (BooK),
1577 Reini Urban, Renee Baecker, Ricardo Signes, Richard Leach, Russ
1578 Allbery, Scott Baker, Sevan Janiyan, Sidney Markowitz, Sisyphus, Steve
1579 Hay, TAKAI Kousuke, Todd Rinaldo, Tomasz Konojacki, Tom Stellard, Tony
1580 Cook, Tsuyoshi Watanabe, Unicode Consortium, vsfos, Yves Orton,
1581 Zakariyya Mughal, Zefram, 小鸡.
1582
1583 The list above is almost certainly incomplete as it is automatically
1584 generated from version control history. In particular, it does not
1585 include the names of the (very much appreciated) contributors who
1586 reported issues to the Perl bug tracker.
1587
1588 Many of the changes included in this version originated in the CPAN
1589 modules included in Perl's core. We're grateful to the entire CPAN
1590 community for helping Perl to flourish.
1591
1592 For a more complete list of all of Perl's historical contributors,
1593 please see the AUTHORS file in the Perl source distribution.
1594
1596 If you find what you think is a bug, you might check the perl bug
1597 database at <https://github.com/Perl/perl5/issues>. There may also be
1598 information at <http://www.perl.org/>, the Perl Home Page.
1599
1600 If you believe you have an unreported bug, please open an issue at
1601 <https://github.com/Perl/perl5/issues>. Be sure to trim your bug down
1602 to a tiny but sufficient test case.
1603
1604 If the bug you are reporting has security implications which make it
1605 inappropriate to send to a public issue tracker, then see "SECURITY
1606 VULNERABILITY CONTACT INFORMATION" in perlsec for details of how to
1607 report the issue.
1608
1610 If you wish to thank the Perl 5 Porters for the work we had done in
1611 Perl 5, you can do so by running the "perlthanks" program:
1612
1613 perlthanks
1614
1615 This will send an email to the Perl 5 Porters list with your show of
1616 thanks.
1617
1619 The Changes file for an explanation of how to view exhaustive details
1620 on what changed.
1621
1622 The INSTALL file for how to build Perl.
1623
1624 The README file for general stuff.
1625
1626 The Artistic and Copying files for copyright information.
1627
1628
1629
1630perl v5.38.2 2023-11-30 PERL5380DELTA(1)