5 perldelta - what is new for perl v5.38.0
9 This document describes differences between the 5.36.0 release and the 5.38.0
12 =head1 Core Enhancements
14 =head2 New C<class> Feature
16 A new B<experimental> syntax is now available for defining object classes,
17 where per-instance data is stored in "field" variables that behave like
27 method zero { $x = $y = 0; }
30 This is described in more detail in L<perlclass>. Notes on the internals of
31 its implementation and other related details can be found in L<perlclassguts>.
33 This remains a new and experimental feature, and is very much still under
34 development. It will be the subject of much further addition, refinement and
35 alteration in future releases. As it is experimental, it yields warnings in
36 the C<experimental::class> category. These can be silenced by a
37 C<no warnings> statement.
40 no warnings 'experimental::class';
42 =head2 Unicode 15.0 is supported
44 See L<https://www.unicode.org/versions/Unicode15.0.0/> for details.
46 =head2 Deprecation warnings now have specific subcategories
48 All deprecation warnings now have their own specific deprecation category which
49 can be disabled individually. You can see a list of all deprecated features in
50 L<perldeprecation>, and in L<warnings>. The following list is from L<warnings>:
54 | +- deprecated::apostrophe_as_package_separator
56 | +- deprecated::delimiter_will_be_paired
58 | +- deprecated::dot_in_inc
60 | +- deprecated::goto_construct
62 | +- deprecated::smartmatch
64 | +- deprecated::unicode_property_name
66 | +- deprecated::version_downgrade
68 It is still possible to disable all deprecation warnings in a single
71 no warnings 'deprecated';
73 but now is possible to have a finer grained control. As has historically been
74 the case these warnings are automatically enabled with
78 =head2 %{^HOOK} API introduced
80 For various reasons it can be difficult to create subroutine wrappers
81 for some of perls keywords. Any keyword which has an undefined
82 prototype simply cannot be wrapped with a subroutine, and some keywords
83 which perl permits to be wrapped are in practice very tricky to wrap.
84 For example C<require> is tricky to wrap, it is possible but doing so
85 changes the stack depth, and the standard methods of exporting assume
86 that they will be exporting to a package at certain stack depth up the
87 stack, and the wrapper will thus change where functions are exported to
88 unless implemented with a great deal of care. This can be very awkward
91 Accordingly we have introduced a new hash called C<%{^HOOK}> which is
92 intended to facilitate such cases. When a keyword supports any kind of
93 special hook then the hook will live in this new hash. Hooks in this
94 hash will be named after the function they are called by, followed by
95 two underbars and then the phase they are executed in, currently either
96 before or after the keyword is executed.
98 In this initial release we support two hooks C<require__before> and
99 C<require__after>. These are provided to make it easier to perform tasks
100 before and after a require statement.
102 See L<perlvar> for more details.
104 =head2 PERL_RAND_SEED
106 Added a new environment variable C<PERL_RAND_SEED> which can be used to
107 cause a perl program which uses C<rand> without using C<srand()>
108 explicitly or which uses C<srand()> with no arguments to be repeatable.
109 See L<perlrun>. This feature can be disabled at compile time by passing
111 -Accflags=-DNO_PERL_RAND_SEED
113 to F<Configure> during the build process.
115 =head2 Defined-or and logical-or assignment default expressions in signatures
117 The default expression for a subroutine signature parameter can now be
118 assigned using the C<//=> or C<||=> operators, to apply the defaults whenever
119 the caller provided an undefined or false value (respectively), rather than
120 simply when the parameter is missing entirely. For more detail see the
121 documentation in L<perlsub>.
123 =head2 @INC Hook Enhancements and $INC and INCDIR
125 The internals for C<@INC> hooks have been hardened to handle various
126 edge cases and should no longer segfault or throw assert failures when
127 hooks modify C<@INC> during a require operation. As part of this we
128 now ensure that any given hook is executed at most once during a require
129 call, and that any duplicate directories do not trigger additional
132 To provide developers more control over dynamic module lookup, a new hook
133 method C<INCDIR> is now supported. An object supporting this method may be
134 injected into the C<@INC> array, and when it is encountered in the module
135 search process it will be executed, just like how INC hooks are executed,
136 and its return value used as a list of directories to search for the
137 module. Returning an empty list acts as a no-op. Note that since any
138 references returned by this hook will be stringified and used as strings,
139 you may not return a hook to be executed later via this API.
141 When an C<@INC> hook (either C<INC> or C<INCDIR>) is called during
142 require, the C<$INC> variable will be localized to be the value of the
143 index of C<@INC> that the hook came from. If the hook wishes to override
144 what the "next" index in C<@INC> should be it may update C<$INC> to be one
145 less than the desired index (C<undef> is equivalent to C<-1>). This
146 allows an C<@INC> hook to completely rewrite the C<@INC> array and have
147 perl restart its directory probes from the beginning of C<@INC>.
149 Blessed CODE references in C<@INC> that do not support the C<INC> or
150 C<INCDIR> methods will no longer trigger an exception, and instead will
151 be treated the same as unblessed coderefs are, and executed as though
152 they were an C<INC> hook.
154 =head2 Forbidden control flow out of C<defer> or C<finally> now detected at compile-time
156 It is forbidden to attempt to leave a C<defer> or C<finally> block by means
157 of control flow such as C<return> or C<goto>. Previous versions of perl could
158 only detect this when actually attempted at runtime.
160 This version of perl adds compile-time detection for many cases that can be
161 statically determined. This may mean that code which compiled successfully on
162 a previous version of perl is now reported as a compile-time error with this
163 one. This only happens in cases where it would have been an error to actually
164 execute the code anyway; the error simply happens at an earlier time.
166 =head2 Optimistic Eval in Patterns
168 The use of C<(?{ ... })> and C<(??{ ... })> in a pattern disables various
169 optimisations globally in that pattern. This may or may not be desired by the
170 programmer. This release adds the C<(*{ ... })>
171 equivalent. The only difference is that it does not and will never disable
172 any optimisations in the regex engine. This may make it more unstable in the
173 sense that it may be called more or less times in the future, however the
174 number of times it executes will truly match how the regex engine functions.
175 For example, certain types of optimisation are disabled when C<(?{ ... })> is
176 included in a pattern, so that patterns which are O(N) in normal use become
177 O(N*N) with a C<(?{ ... })> pattern in them. Switching to C<(*{ ... })> means
178 the pattern will stay O(N).
180 =head2 REG_INF has been raised from 65,536 to 2,147,483,647
182 Many regex quantifiers used to be limited to U16_MAX in the past, but are
183 now limited to I32_MAX, thus it is now possible to write /(?:word){1000000}/
184 for example. Note that doing so may cause the regex engine to run longer
187 =head2 New API functions optimize_optree and finalize_optree
189 There are two new API functions for operating on optree fragments, ensuring
190 you can invoke the required parts of the optree-generation process that might
191 otherwise not get invoked (e.g. when creating a custom LOGOP). To get access
192 to these functions, you first need to set a C<#define> to opt-in to using
195 #define PERL_USE_VOLATILE_API
197 These functions are closely tied to the internals of how the interpreter
198 works, and could be altered or removed at any time if other internal changes
201 =head2 Some C<goto>s are now permitted in C<defer> and C<finally> blocks
203 Perl version 5.36.0 added C<defer> blocks and permitted the C<finally> keyword
204 to also add similar behaviour to C<try>/C<catch> syntax. These did not permit
205 any C<goto> expression within the body, as it could have caused control flow
206 to jump out of the block. Now, some C<goto> expressions are allowed, if they
207 have a constant target label, and that label is found within the block.
213 print "This does not execute\n";
214 LABEL: print "This does\n";
217 =head2 New regexp variable ${^LAST_SUCCESSFUL_PATTERN}
219 This allows access to the last succesful pattern that matched in the current
220 scope. Many aspects of the regex engine refer to the "last successful
221 pattern". The empty pattern reuses it, and all of the magic regex vars relate
222 to it. This allows access to its pattern. The following code
224 if (m/foo/ || m/bar/) {
228 can be rewritten as follows
230 if (m/foo/ || m/bar/) {
231 s/${^LAST_SUCCESSFUL_PATTERN}/PQR/;
234 and it will do the exactly same thing.
236 =head2 Locale category LC_NAME now supported on participating platforms
238 On platforms that have the GNU extension C<LC_NAME> category, you may now use
239 it as the category parameter to L<POSIX/setlocale> to set and query its locale.
241 =head1 Incompatible Changes
243 =head2 readline() no longer clears the stream error and eof flags
245 C<readline()>, also spelled C<< <> >>, would clear the handle's error
246 and eof flags after an error occurred on the stream.
248 In nearly all cases this clear is no longer done, so the error and
249 eof flags now properly reflect the status of the stream after
252 Since the error flag is no longer cleared calling close() on the
253 stream may fail and if the stream was not explicitly closed, the
254 implicit close of the stream may produce a warning.
256 This has resulted in two main types of problems in downstream CPAN
257 modules, and these may also occur in your code:
263 If your code reads to end of file, and then rebinds the handle to a
264 new file descriptor, previously since the eof flag wasn't set you
265 could continue to read from the stream. You now need to clear the eof
266 flag yourself with C<< $handle->clearerr() >> to continue reading.
270 If your code encounters an error on the stream while reading with
271 readline() you will need to call C<< $handle->clearerr >> to continue
272 reading. The one case this occurred the underlying file descriptor was
273 marked non-blocking, so the read() system call was failing with
274 C<EAGAIN>, which resulted in the error flag being set on the stream.
278 The only case where error and eof flags continue to cleared on
279 error is when reading from the child process for glob() in
280 F<miniperl>. This allows it to correctly report errors from the child
281 process on close(). This is unlikely to be an issue during normal
284 [L<GH #20060|https://github.com/Perl/perl5/issues/20060>]
286 =head2 C<INIT> blocks no longer run after an C<exit()> in C<BEGIN>
288 C<INIT> blocks will no longer run after an C<exit()> performed inside of
289 a C<BEGIN>. This means that the combination of the C<-v> option and the
290 C<-c> option no longer executes a compile check as well as showing the
291 perl version. The C<-v> option executes an exit(0) after printing the
292 version information inside of a C<BEGIN> block, and the C<-c> check is
293 implemented by using C<INIT> hooks, resulting in the C<-v> option taking
296 [L<GH #1537|https://github.com/Perl/perl5/issues/1537>]
297 [L<GH #20181|https://github.com/Perl/perl5/issues/20181>]
299 =head2 Syntax errors will no longer produce "phantom error messages".
301 Generally perl will continue parsing the source code even after
302 encountering a compile error. In many cases this is helpful, for
303 instance with misspelled variable names it is helpful to show as many
304 examples of the error as possible. But in the case of syntax errors
305 continuing often produces bizarre error messages, and may even cause
306 segmentation faults during the compile process. In this release the
307 compiler will halt at the first syntax error encountered. This means
308 that any code expecting to see the specific error messages we used to
309 produce will be broken. The error that is emitted will be one of the
310 diagnostics that used to be produced, but in some cases some messages
311 that used to be produced will no longer be displayed.
313 See L<Changes to Existing Diagnostics> for more details.
315 =head2 L<C<utf8::upgrade()>|utf8/Utility functions>
317 Starting in this release, if the input string is C<undef>, it remains
318 C<undef>. Previously it would be changed into a defined, zero-length
321 =head2 Changes to "thread-safe" locales
323 Perl 5.28 introduced "thread-safe" locales on systems that supported
324 them, namely modern Windows, and systems supporting POSIX 2008 locale
325 operations. These systems accomplish this by having per-thread locales,
326 while continuing to support the older global locale operations for code
327 that doesn't take the steps necessary to use the newer per-thread ones.
329 It turns out that some POSIX 2008 platforms have or have had buggy
330 implementations, which forced perl to not use them. The
331 C<${^SAFE_LOCALES}> scalar variable contains 0 or 1 to indicate whether
332 or not the current platform is considered by perl to have a working
333 thread-safe implementation. Some implementations have been fixed
334 already, but FreeBSD and Cygwin have been newly discovered to be
335 sufficiently buggy that the thread-safe operations are no longer used by
336 perl, starting in this release. Hence, C<${^SAFE_LOCALES}> is now 0 for
337 them. Older versions of perl can be configured to avoid these buggy
338 implementations by adding the F<Configure> option
339 C<-DNO_POSIX_2008_LOCALE>.
341 And v5.38 fixes a bug in all previous perls that led to locales not
342 being fully thread-safe. The first thread that finishes caused
343 the main thread (named C<thread0>) to revert to the global locale in
344 effect at startup, discarding whatever the thread's locale had been
345 previously set to. If any other thread had switched to the global
346 locale by calling C<switch_to_global_locale()> in XS code, those threads
347 would all share the global locale, and C<thread0> would not be
352 =head2 Use of C<'> as a package name separator is deprecated
354 Using C<'> as package separator in a variable named in a double-quoted
355 string has warned since 5.28. It is now deprecated in both string
356 interpolation and non-interpolated contexts, and will be removed in
359 =head1 Performance Enhancements
365 Additional optree optimizations for common OP patterns. For example, multiple
366 simple OPs replaced by a single streamlined OP, so as to be more efficient at
367 runtime. L<[GH #19943]|https://github.com/Perl/perl5/pull/19943>,
368 L<[GH #20063]|https://github.com/Perl/perl5/pull/20063>,
369 L<[GH #20077]|https://github.com/Perl/perl5/pull/20077>.
373 Creating an anonymous sub no longer generates an C<srefgen> op, the
374 reference generation is now done in the C<anoncode> or C<anonconst>
375 op, saving runtime. [github #20290]
379 =head1 Modules and Pragmata
381 =head2 Updated Modules and Pragmata
387 Added the C<is_tainted()> builtin function. [L<github #19854|https://github.com/Perl/perl5/issues/19854>]
391 Added the C<export_lexically()> builtin function as per PPC 0020. [L<github #19895|https://github.com/Perl/perl5/issues/19895>]
395 Support for PPC 0018, C<use feature "module_true";> has been added to
396 the default feature bundle for v5.38 and later. It may also be used
397 explicitly. When enabled inside of a module the module does not need
398 to return true explicitly, and in fact the return will be forced to
399 a simple true value regardless of what it originally was.
403 L<Attribute::Handlers> has been upgraded from version 1.02 to 1.03.
407 L<attributes> has been upgraded from version 0.34 to 0.35.
411 L<autodie> has been upgraded from version 2.34 to 2.36.
415 L<B> has been upgraded from version 1.83 to 1.88.
419 L<B::Concise> has been upgraded from version 1.006 to 1.007.
423 L<B::Deparse> has been upgraded from version 1.64 to 1.74.
427 L<Benchmark> has been upgraded from version 1.23 to 1.24.
431 L<bignum> has been upgraded from version 0.65 to 0.66.
435 L<Carp> has been upgraded from version 1.52 to 1.54.
439 L<Class::Struct> has been upgraded from version 0.66 to 0.68.
443 L<Compress::Raw::Bzip2> has been upgraded from version 2.103 to 2.204_001.
447 L<Compress::Raw::Zlib> has been upgraded from version 2.105 to 2.204_001.
451 L<Config::Perl::V> has been upgraded from version 0.33 to 0.36.
455 L<CPAN> has been upgraded from version 2.33 to 2.36.
459 L<Data::Dumper> has been upgraded from version 2.184 to 2.188.
463 L<DB_File> has been upgraded from version 1.857 to 1.858.
467 L<Devel::Peek> has been upgraded from version 1.32 to 1.33.
471 L<Devel::PPPort> has been upgraded from version 3.68 to 3.71.
475 L<Digest::MD5> has been upgraded from version 2.58 to 2.58_01.
479 L<Digest::SHA> has been upgraded from version 6.02 to 6.04.
483 L<DynaLoader> has been upgraded from version 1.52 to 1.54.
487 L<Encode> has been upgraded from version 3.17 to 3.19.
491 L<encoding::warnings> has been upgraded from version 0.13 to 0.14.
495 L<Env> has been upgraded from version 1.05 to 1.06.
499 L<Errno> has been upgraded from version 1.36 to 1.37.
503 L<experimental> has been upgraded from version 0.028 to 0.031.
507 L<ExtUtils::CBuilder> has been upgraded from version 0.280236 to 0.280238.
511 L<ExtUtils::Install> has been upgraded from version 2.20 to 2.22.
515 L<ExtUtils::MakeMaker> has been upgraded from version 7.64 to 7.70.
519 L<ExtUtils::Miniperl> has been upgraded from version 1.11 to 1.13.
523 L<ExtUtils::ParseXS> has been upgraded from version 3.45 to 3.51.
527 L<ExtUtils::PL2Bat> has been upgraded from version 0.004 to 0.005.
531 L<ExtUtils::Typemaps> has been upgraded from version 3.45 to 3.51.
535 L<feature> has been upgraded from version 1.72 to 1.82.
539 L<File::Basename> has been upgraded from version 2.85 to 2.86.
543 L<File::Copy> has been upgraded from version 2.39 to 2.41.
547 L<File::Find> has been upgraded from version 1.40 to 1.43.
551 L<File::Glob> has been upgraded from version 1.37 to 1.40.
555 L<File::Spec> has been upgraded from version 3.84 to 3.89.
559 L<File::stat> has been upgraded from version 1.12 to 1.13.
563 L<FileHandle> has been upgraded from version 2.03 to 2.05.
567 L<Filter::Util::Call> has been upgraded from version 1.60 to 1.64.
571 L<GDBM_File> has been upgraded from version 1.23 to 1.24.
575 L<Getopt::Long> has been upgraded from version 2.52 to 2.54.
579 L<Hash::Util> has been upgraded from version 0.28 to 0.30.
583 L<HTTP::Tiny> has been upgraded from version 0.080 to 0.083.
587 L<I18N::Langinfo> has been upgraded from version 0.21 to 0.22.
591 L<IO> has been upgraded from version 1.50 to 1.52.
595 IO-Compress has been upgraded from version 2.106 to 2.204.
599 L<IO::Zlib> has been upgraded from version 1.11 to 1.14.
603 L<JSON::PP> has been upgraded from version 4.07 to 4.16.
607 libnet has been upgraded from version 3.14 to 3.15.
611 L<Locale::Maketext> has been upgraded from version 1.31 to 1.33.
615 L<Math::BigInt> has been upgraded from version 1.999830 to 1.999837.
619 L<Math::BigInt::FastCalc> has been upgraded from version 0.5012 to 0.5013.
623 L<Math::BigRat> has been upgraded from version 0.2621 to 0.2624.
627 L<Math::Complex> has been upgraded from version 1.5902 to 1.62.
631 L<Memoize> has been upgraded from version 1.03_01 to 1.16.
635 L<MIME::Base64> has been upgraded from version 3.16 to 3.16_01.
639 L<Module::CoreList> has been upgraded from version 5.20220520 to 5.20230520.
643 L<mro> has been upgraded from version 1.26 to 1.28.
647 L<NDBM_File> has been upgraded from version 1.15 to 1.16.
651 L<Net::Ping> has been upgraded from version 2.74 to 2.76.
655 L<ODBM_File> has been upgraded from version 1.17 to 1.18.
659 L<Opcode> has been upgraded from version 1.57 to 1.64.
663 L<overload> has been upgraded from version 1.35 to 1.37.
667 L<parent> has been upgraded from version 0.238 to 0.241.
671 L<PerlIO::via::QuotedPrint> has been upgraded from version 0.09 to 0.10.
675 L<Pod::Checker> has been upgraded from version 1.74 to 1.75.
679 L<Pod::Html> has been upgraded from version 1.33 to 1.34.
683 L<Pod::Usage> has been upgraded from version 2.01 to 2.03.
687 L<podlators> has been upgraded from version 4.14 to 5.01.
691 L<POSIX> has been upgraded from version 2.03 to 2.13.
695 L<re> has been upgraded from version 0.43 to 0.44.
699 L<Safe> has been upgraded from version 2.43 to 2.44.
703 L<Scalar::Util> has been upgraded from version 1.62 to 1.63.
707 L<SDBM_File> has been upgraded from version 1.15 to 1.17.
711 L<Socket> has been upgraded from version 2.033 to 2.036.
715 L<Storable> has been upgraded from version 3.26 to 3.32.
719 L<Sys::Hostname> has been upgraded from version 1.24 to 1.25.
723 L<Term::Cap> has been upgraded from version 1.17 to 1.18.
727 L<Test::Simple> has been upgraded from version 1.302190 to 1.302194.
731 L<Text::Balanced> has been upgraded from version 2.04 to 2.06.
735 L<threads> has been upgraded from version 2.27 to 2.36.
739 L<threads::shared> has been upgraded from version 1.64 to 1.68.
743 L<Tie::File> has been upgraded from version 1.06 to 1.07.
747 L<Time::HiRes> has been upgraded from version 1.9770 to 1.9775.
751 L<Time::Piece> has been upgraded from version 1.3401 to 1.3401_01.
755 L<Unicode::Normalize> has been upgraded from version 1.31 to 1.32.
759 L<UNIVERSAL> has been upgraded from version 1.14 to 1.15.
763 L<User::grent> has been upgraded from version 1.03 to 1.04.
767 L<User::pwent> has been upgraded from version 1.01 to 1.02.
771 L<utf8> has been upgraded from version 1.24 to 1.25.
775 L<warnings> has been upgraded from version 1.58 to 1.65.
779 L<XS::APItest> has been upgraded from version 1.22 to 1.32.
783 L<XSLoader> has been upgraded from version 0.31 to 0.32.
789 =head2 New Documentation
793 Describes the new C<class> feature.
795 =head3 L<perlclassguts>
797 Describes the internals of the new C<class> feature.
799 =head2 Changes to Existing Documentation
801 We have attempted to update the documentation to reflect the changes
802 listed in this document. If you find any we have missed, open an issue
803 at L<https://github.com/Perl/perl5/issues>.
805 Additionally, the following selected changes have been made:
813 Documented L<C<hv_ksplit>|perlapi/hv_ksplit>
817 Documented L<C<hv_name_set>|perlapi/hv_name_set>
821 L<C<hv_store>|perlapi/hv_store> and L<C<hv_stores>|perlapi/hv_stores>
822 documentation have been greatly improved.
826 Documented L<C<gv_autoload_pv>|perlapi/gv_autoload_pv>
830 Documented L<C<gv_autoload_pvn>|perlapi/gv_autoload_pvn>
834 Documented L<C<gv_autoload_sv>|perlapi/gv_autoload_sv>
838 Documented L<C<gv_name_set>|perlapi/gv_name_set>
842 Documented L<C<start_subparse>|perlapi/start_subparse>
846 Documented L<C<SV_CHECK_THINKFIRST_COW_DROP>|perlapi/SV_CHECK_THINKFIRST_COW_DROP>
850 Documented L<C<SV_CHECK_THINKFIRST>|perlapi/SV_CHECK_THINKFIRST>
854 Documented L<C<SvPV_shrink_to_cur>|perlapi/SvPV_shrink_to_cur>
858 Documented L<C<save_aelem>|perlapi/save_aelem>
862 Documented L<C<save_aelem_flags>|perlapi/save_aelem_flags>
866 Documented L<C<save_helem>|perlapi/save_helem>
870 Documented L<C<save_helem_flags>|perlapi/save_helem_flags>
874 =head3 L<perldeprecation>
880 Added information about unscheduled deprecations and their categories.
884 Added category information for existing scheduled deprecations.
888 Added smartmatch and apostrophe as a package separator deprecation data.
898 Documented L<C<save_pushptr>|perlintern/save_pushptr>
902 Documented L<C<save_scalar_at>|perlintern/save_scalar_at>
906 Entries have been added to L<perlguts> for the new C<newAV_alloc_x>, C<newAV_alloc_xz> and
907 C<*_simple> functions.
911 References to the now-defunct PrePAN service have been removed from
912 L<perlcommunity> and L<perlmodstyle>.
916 A section on symbol naming has been added to L<perlhacktips>.
920 L<perlexperiment> has been edited to properly reference the warning categories
921 for the defer block modifier and extra paired delimiters for quote-like
926 =head3 L<perlexperiment>
932 Smartmatch has been moved from experimental status to deprecated status.
933 Unfortunately the experiment did not work out.
943 Some wording improvements have been made for the C<ucfirst>, C<push>,
944 C<unshift> and C<bless> functions, as well as additional examples added.
954 A new section, L<perlhacktips/Writing safer macros> has been added to discuss
955 pitfalls and solutions to using C macros in C and XS code.
959 A new section, L<perlhacktips/Choosing good symbol names>, has been added to
960 discuss unexpected gotchas with names.
970 Document the behavior of matching the empty pattern better and specify
971 its relationship to the new C<${^LAST_SUCCESSFUL_PATTERN}> properly.
983 Added a section on "Scoping Rules of Regex Variables", and other wording
984 improvements made throughout.
988 Added information on the new C<%{^HOOK}> interface, and the new
989 C<require__before> and C<require__after> hooks which it exposes.
993 Correct information on the regex variables C<${^PREMATCH}>, C<${^MATCH}>
994 and C<${^POSTMATCH}>, all of which were incorrectly documented due to an
995 oversight. Specifically they only work properly after a regex operation
996 that used the /p modifier to enable them.
1000 Added information on the new regex variable C<${^LAST_SUCCESSFUL_PATTERN}>,
1001 which represents the pattern of the last successful regex match in scope.
1007 The following additions or changes have been made to diagnostic output,
1008 including warnings and fatal error messages. For the complete list of
1009 diagnostic messages, see L<perldiag>.
1011 =head2 New Diagnostics
1019 A new syntax error has been added for the error that a C<catch> block does
1020 not have its required variable declaration. See
1021 L<catch block requires a (VAR)|perldiag/"catch block requires a (VAR)">
1025 L<Too many nested BEGIN blocks, maximum of %d allowed|perldiag/"Too many nested BEGIN blocks, maximum of %d allowed">
1029 L<Execution of %s aborted due to compilation errors.|perldiag/"Execution of %s aborted due to compilation errors.">
1033 L<Attempt to bless into a class|perldiag/"Attempt to bless into a class">
1035 (F) You are attempting to call C<bless> with a package name that is a
1036 new-style C<class>. This is not necessary, as instances created by the
1037 constructor are already in the correct class. Instances cannot be created
1038 by other means, such as C<bless>.
1042 L<Cannot assign :param(%s) to field %s because that name is already in use|perldiag/"Cannot assign :param(%s) to field %s because that name is already in use">
1044 (F) An attempt was made to apply a parameter name to a field, when the name
1045 is already being used by another field in the same class, or one of its
1046 parent classes. This would cause a name clash so is not allowed.
1050 L<Cannot create class %s as it already has a non-empty @ISA|perldiag/"Cannot create class %s as it already has a non-empty @ISA">
1052 (F) An attempt was made to create a class out of a package that already has
1053 an C<@ISA> array, and the array is not empty. This is not permitted, as it
1054 would lead to a class with inconsistent inheritance.
1058 L<Cannot invoke a method of "%s" on an instance of "%s"|perldiag/"Cannot invoke a method of "%s" on
1059 an instance of "%s"">
1061 (F) You tried to directly call a C<method> subroutine of one class by passing
1062 in a value that is an instance of a different class. This is not permitted,
1063 as the method would not have access to the correct instance fields.
1067 L<Cannot invoke method on a non-instance|perldiag/"Cannot invoke method on a non-instance">
1069 (F) You tried to directly call a C<method> subroutine of a class by passing
1070 in a value that is not an instance of that class. This is not permitted, as
1071 the method would not then have access to its instance fields.
1075 L<Cannot '%s' outside of a 'class'|perldiag/"Cannot '%s' outside of a 'class'">
1077 (F) You attempted to use one of the keywords that only makes sense inside
1078 a C<class> definition, at a location that is not inside such a class.
1082 L<Cannot reopen existing class "%s"|perldiag/"Cannot reopen existing class "%s"">
1084 (F) You tried to begin a C<class> definition for a class that already exists.
1085 A class may only have one definition block.
1089 L<Can't bless an object reference|perldiag/"Can't bless an object reference">
1091 (F) You attempted to call C<bless> on a value that already refers to a real
1096 L<can't convert empty path|perldiag/"can't convert empty path">
1098 (F) On Cygwin, you called a path conversion function with an empty path.
1099 Only non-empty paths are legal.
1103 L<Class already has a superclass, cannot add another|perldiag/"Class already has a superclass, cannot add another">
1105 (F) You attempted to specify a second superclass for a C<class> by using
1106 the C<:isa> attribute, when one is already specified. Unlike classes
1107 whose instances are created with C<bless>, classes created via the
1108 C<class> keyword cannot have more than one superclass.
1112 L<Class attribute %s requires a value|perldiag/"Class attribute %s requires a value">
1114 (F) You specified an attribute for a class that would require a value to
1115 be passed in parentheses, but did not provide one. Remember that
1116 whitespace is B<not> permitted between the attribute name and its value;
1117 you must write this as
1119 class Example::Class :attr(VALUE) ...
1123 L<Class :isa attribute requires a class but "%s" is not one|perldiag/"Class :isa attribute requires a class but "%s" is not one">
1125 (F) When creating a subclass using the C<class> C<:isa> attribute, the
1126 named superclass must also be a real class created using the C<class>
1131 L<Field already has a parameter name, cannot add another|perldiag/"Field already has a parameter name, cannot add another">
1133 (F) A field may have at most one application of the C<:param> attribute to
1134 assign a parameter name to it; once applied a second one is not allowed.
1138 L<Field attribute %s requires a value|perldiag/"Field attribute %s requires a value">
1140 (F) You specified an attribute for a field that would require a value to
1141 be passed in parentheses, but did not provide one. Remember that
1142 whitespace is B<not> permitted between the attribute name and its value;
1143 you must write this as
1145 field $var :attr(VALUE) ...
1149 L<Field %s is not accessible outside a method|perldiag/"Field %s is not accessible outside a method">
1151 (F) An attempt was made to access a field variable of a class from code
1152 that does not appear inside the body of a C<method> subroutine. This is not
1153 permitted, as only methods will have access to the fields of an instance.
1157 L<Field %s of "%s" is not accessible in a method of "%s"|perldiag/"Field %s of "%s" is not accessible in a method of "%s"">
1159 (F) An attempt was made to access a field variable of a class, from a
1160 method of another class nested inside the one that actually defined it.
1161 This is not permitted, as only methods defined by a given class are
1162 permitted to access fields of that class.
1166 L<Only scalar fields can take a :param attribute|perldiag/"Only scalar fields can take a :param attribute">
1168 (F) You tried to apply the C<:param> attribute to an array or hash field.
1169 Currently this is not permitted.
1173 L<Required parameter '%s' is missing for %s constructor|perldiag/"Required parameter '%s' is missing for %s constructor">
1175 (F) You called the constructor for a class that has a required named
1176 parameter, but did not pass that parameter at all.
1180 L<Unexpected characters while parsing class :isa attribute: %s|perldiag/"Unexpected characters while parsing class :isa attribute: %s">
1182 (F) You tried to specify something other than a single class name with an
1183 optional trailing version number as the value for a C<class> C<:isa>
1184 attribute. This confused the parser.
1188 L<Unrecognized class attribute %s|perldiag/"Unrecognized class attribute %s">
1190 (F) You attempted to add a named attribute to a C<class> definition, but
1191 perl does not recognise the name of the requested attribute.
1195 L<Unrecognized field attribute %s|perldiag/"Unrecognized field attribute %s">
1197 (F) You attempted to add a named attribute to a C<field> definition, but
1198 perl does not recognise the name of the requested attribute.
1202 L<${^HOOK}{%s} may only be a CODE reference or undef|perldiag/"${^HOOK}{%s} may only be a CODE reference or undef">
1206 L<Attempt to set unknown hook '%s' in %{^HOOK}|perldiag/"Attempt to set unknown hook '%s' in %{^HOOK}">
1210 L<Missing or undefined argument to %s via %{^HOOK}{require__before}|perldiag/"Missing or undefined argument to %s via %{^HOOK}{require__before}">
1214 L<Too many capture groups (limit is %d) in regex mE<sol>%sE<sol>|perldiag/"Too many capture groups (limit is %d) in regex m/%s/">
1224 L<Unknown locale category %d|perldiag/"Unknown locale category %d">
1226 This is a shortened form of an already existing diagnostic, for use when
1227 there is no new locale being switched to. The previous diagnostic was
1228 misleading in such circumstances.
1232 L<Locale '%s' is unsupported, and may crash the interpreter.|perldiag/"Locale '%s' is unsupported, and may crash the interpreter.">
1236 L<Treating %s::INIT block as BEGIN block as workaround|perldiag/"Treating %s::INIT block as BEGIN block as workaround">
1240 L<Filehandle STD%s reopened as %s only for input|perldiag/"Filehandle STD%s reopened as %s only for input">
1244 L<%s on BEGIN block ignored|perldiag/"%s on BEGIN block ignored">
1248 L<ADJUST is experimental|perldiag/"ADJUST is experimental">
1250 (S experimental::class) This warning is emitted if you use the C<ADJUST>
1251 keyword of C<use feature 'class'>. This keyword is currently
1252 experimental and its behaviour may change in future releases of Perl.
1256 L<class is experimental|perldiag/"class is experimental">
1258 (S experimental::class) This warning is emitted if you use the C<class>
1259 keyword of C<use feature 'class'>. This keyword is currently
1260 experimental and its behaviour may change in future releases of Perl.
1264 L<Method %s redefined|perldiag/"Method %s redefined">
1266 (W redefine) You redefined a method. To suppress this warning, say
1269 no warnings 'redefine';
1270 *name = method { ... };
1275 L<Odd number of elements in hash field initialization|perldiag/"Odd number of elements in hash field initialization">
1277 (W misc) You specified an odd number of elements to initialise a hash
1278 field of an object. Hashes are initialised from a list of key/value
1279 pairs so there must be a corresponding value to every key. The final
1280 missing value will be filled in with undef instead.
1284 L<Old package separator "'" deprecated|perldiag/"Old package separator "'" deprecated">
1286 (W deprecated, syntax) You used the old package separator "'" in a
1287 variable, subroutine or package name. Support for the old package
1288 separator will be removed in Perl 5.40.
1292 L<field is experimental|perldiag/"field is experimental">
1294 (S experimental::class) This warning is emitted if you use the C<field>
1295 keyword of C<use feature 'class'>. This keyword is currently
1296 experimental and its behaviour may change in future releases of Perl.
1300 L<method is experimental|perldiag/"method is experimental">
1302 (S experimental::class) This warning is emitted if you use the C<method>
1303 keyword of C<use feature 'class'>. This keyword is currently
1304 experimental and its behaviour may change in future releases of Perl.
1308 L<Can't call destructor for 0x%p in global destruction|perldiag/"Can't call destructor for 0x%p in global destruction">
1313 =head2 Changes to Existing Diagnostics
1319 The compiler will now stop parsing on the first syntax error it
1320 encounters. Historically the compiler would attempt to "skip past" the
1321 error and continue parsing so that it could list multiple errors. For
1322 things like undeclared variables under strict this makes sense. For
1323 syntax errors however it has been found that continuing tends to result
1324 in a storm of unrelated or bizarre errors that mostly just obscure the
1325 true error. In extreme cases it can even lead to segfaults and other
1328 Therefore we have reformed the continuation logic so that the parse will
1329 stop after the first seen syntax error. Semantic errors like undeclared
1330 variables will not stop the parse, so you may still see multiple errors
1331 when compiling code. However if there is a syntax error it will be the
1332 last error message reported by perl and all of the errors that you see
1333 will be something that actually needs to be fixed.
1337 Error messages that output class or package names have been modified to
1338 output double quoted strings with various characters escaped so as to
1339 make the exact value clear to a reader. The exact rules on which
1340 characters are escaped may change over time but currently are that
1341 printable ASCII codepoints, with the exception of C<"> and C<\>, and
1342 unicode word characters whose codepoint is over 255 are output raw, and
1343 any other symbols are escaped much as Data::Dumper might escape them,
1344 using C<\n> for newline and C<\"> for double quotes, etc. Codepoints in
1345 the range 128-255 are always escaped as they can cause trouble on
1346 unicode terminals when output raw.
1348 In older versions of perl the one liner
1350 $ perl -le'"thing\n"->foo()'
1352 would output the following error message exactly as shown here, with
1353 text spread over multiple lines because the "\n" would be emitted as
1354 a raw newline character:
1356 Can't locate object method "foo" via package "thing
1357 " (perhaps you forgot to load "thing
1360 As of this release we would output this instead (as one line):
1362 Can't locate object method "foo" via package "thing\n"
1363 (perhaps you forgot to load "thing\n"?) at -e line 1.
1365 Notice the newline in the package name has been quoted and escaped, and
1366 thus the error message is a single line. The text is shown here wrapped
1367 to two lines only for readability.
1371 When package or class names in errors are very large the middle excess
1372 portion will be elided from the message. As of this release error messages
1373 will show only up to the first 128 characters and the last 128 characters
1374 in a package or class name in error messages. For example
1376 $ perl -le'("Foo" x 1000)->new()'
1378 will output the following as one line:
1380 Can't locate object method "new" via package "FooFooFooFooFooFooFoo
1381 FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
1382 FooFooFooFooFooFooFooFooFooFooFooFooFooFo"..."oFooFooFooFooFooFooFoo
1383 FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
1384 FooFooFooFooFooFooFooFooFooFooFooFooFoo" (perhaps you forgot to load
1385 "FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
1386 FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFo"...
1387 "oFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo
1388 FooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFooFoo"?)
1391 Notice the C< "prefix"..."suffix" > form of the package name in this case.
1392 In previous versions of perl the complete string would have been shown
1393 making the error message over 6k long and there was no upper limit on the
1394 length of the error message at all. If you accidentally used a 1MB string
1395 as a class name then the error message would be over 2MB long. In this perl
1396 the upper limit should be around 2k when eliding and escaping are taken into
1401 Removed C<< Complex regular subexpression recursion limit (%d) exceeded >>
1403 The regular expresion engine has not used recursion in some time. This
1404 warning no longer makes sense.
1406 See [L<GH #19636|https://github.com/Perl/perl5/pull/19636>].
1410 Various warnings that used to produce parenthesized hints underneath the
1411 main warning message and after its "location data" were chanaged to put
1412 the hint inline with the main message. For instance:
1414 Bareword found where operator expected at -e line 1, near "foo bar"
1415 (Do you need to predeclare foo?)
1417 will now look like this but as one line:
1419 Bareword found where operator expected (Do you need to predeclare
1420 foo?) at -e line 1, near "foo bar"
1422 as a result such warnings will no longer trigger C<$SIG{__WARN__}>
1423 twice, and the hint will be visible when fatal warnings is in effect.
1427 The error message that is produced when a C<require> or C<use> statement
1428 fails has been changed. It used to contain the words C<@INC contains:>,
1429 and it used to show the state of C<@INC> *after* the require had
1430 completed and failed. The error message has been changed to say C<@INC
1431 entries checked:> and to reflect the actual directories or hooks that
1432 were executed during the require statement. For example:
1434 perl -e'push @INC, sub {@INC=()}; eval "require Frobnitz"
1436 Can't locate Frobnitz.pm in @INC (you may need to install the
1437 Frobnitz module) (@INC contains:) at (eval 1) line 1.
1439 Will change to (with some output elided for clarity):
1441 perl -e'push @INC, sub {@INC=()}; eval "require Frobnitz"
1443 Can't locate Frobnitz.pm in @INC (you may need to install the
1444 Frobnitz module) (@INC entries checked:
1445 .../site_perl/5.38.0/x86_64-linux .../site_perl/5.38.0
1446 .../5.38.0/x86_64-linux .../5.38.0 CODE(0x562745e684b8))
1449 thus showing the actual directories checked. Code that checks for
1450 C<@INC contains:> in error messages should be hardened against any future
1451 wording changes between the C<@INC> and C<:>, for instance use
1452 C<qr/\@INC[ \w]+:/> instead of using C<qr/\@INC contains:/> or
1453 C<qr/\@INC entries checked:/> in tests as this will ensure both forward
1454 and backward compatibility.
1458 L<Old package separator used in string|perldiag/"Old package separator used in string">
1460 This diagnostic is now also part of the C<deprecated> category.
1464 L<given is deprecated|perldiag/"given is deprecated"> replaces C<given is experimental>.
1468 L<when is deprecated|perldiag/"when is deprecated"> replaces C<when is experimental>.
1472 L<Smartmatch is deprecated|perldiag/"Smartmatch is deprecated"> replaces C<Smartmatch is experimental>.
1476 =head1 Configuration and Compilation
1482 C<make -j6 minitest> could fail due to a build conflict in building
1483 C<$(MINIPERL_EXE)> between the main make process and a child process.
1488 Properly populate osvers on Dragonfly BSD when the hostname isn't set.
1492 Fix typos for C99 macro name PRIX64.
1496 Remove ancient and broken GCC for VMS support
1500 Remove vestigial reference to /VAXC qualifier
1504 Remove sharedperl option on VMS
1508 VMS now has mkostemp
1512 C<Configure> now properly handles quoted elements outputted by gcc.
1513 [L<GH #20606|https://github.com/Perl/perl5/issues/20606>]
1517 C<Configure> probed for the return type of malloc() and free() by
1518 testing whether declarations for those functions produced a function
1519 type mismatch with the implementation. On Solaris, with a C++
1520 compiler, this check always failed, since Solaris instead imports
1521 malloc() and free() from C<std::> with C<using> for C++ builds. Since
1522 the return types of malloc() and free() are well defined by the C
1523 standard, skip probing for them. C<Configure> command-line arguments
1524 and hints can still override these type in the unlikely case that is
1525 needed. [L<GH #20806|https://github.com/Perl/perl5/issues/20806>]
1531 Tests were added and changed to reflect the other additions and
1532 changes in this release. Furthermore, these significant changes were
1539 Unicode normalization tests have been added.
1543 t/test.pl: Add ability to cancel an watchdog timer
1547 =head1 Platform Support
1549 =head2 Discontinued Platforms
1555 Support code for DEC Ultrix has been removed. Ultrix was the native
1556 Unix-like operating system for various Digital Equipment Corporation
1557 machines. Its final release was in 1995.
1561 =head2 Platform-Specific Notes
1567 Skip tests to workaround an apparent bug in setproctitle(). [L<github #19894|https://github.com/Perl/perl5/issues/19894>]
1571 FreeBSD no longer uses thread-safe locale operations, to avoid L<a bug in
1572 FreeBSD|https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265950>
1574 Replace the first part of archname with `uname -p` [L<github #19791|https://github.com/Perl/perl5/issues/19791>]
1578 Avoid some compiler and compilation issues on NetBSD/Solaris from regexec.c and regcomp.c.
1582 Update Synology Readme for DSM 7.
1586 Fix win32 memory alignment needed for gcc-12 from vmem.h.
1588 utimes() on Win32 would print a message to stderr if it failed to
1589 convert a supplied C<time_t> to to a C<FILETIME>. [github #19668]
1591 In some cases, timestamps returned by L<stat()|perlfunc/stat> and
1592 L<lstat()|perlfunc/lstat> failed to take daylight saving time into account.
1593 [L<GH #20018|https://github.com/Perl/perl5/issues/20018>]
1594 [L<GH #20061|https://github.com/Perl/perl5/issues/20061>]
1596 stat() now works on AF_UNIX socket files. [github #20204]
1598 readlink() now returns the C<PrintName> from a symbolic link reparse
1599 point instead of the C<SubstituteName>, which should make it better
1600 match the name the link was created with. [github #20271]
1602 lstat() on Windows now returns the length of the link target as the
1603 size of the file, as it does on POSIX systems. [github #20476]
1605 symlink() on Windows now replaces any C</> in the target with C<\>,
1606 since Windows does not recognise C</> in symbolic links. The reverse
1607 translation is B<not> done by readlink(). [github #20506]
1609 symlink() where the target was an absolute path to a directory was
1610 incorrectly created as a file symbolic link. [github #20533]
1612 C<POSIX::dup2> no longer creates broken sockets. [L<GH
1613 #20920|https://github.com/Perl/perl5/issues/20920>]
1615 Closing a busy pipe could cause Perl to hang. [L<GH
1616 #19963|https://github.com/Perl/perl5/issues/19963>]
1620 =head1 Internal Changes
1626 Removed many deprecated C functions.
1628 These have been deprecated for a long time. See
1629 L<https://github.com/perl/perl5/commit/7008caa915ad99e650acf2aea40612b5e48b7ba2>
1634 C<get_op_descs>, C<get_op_names>, C<get_opargs>, C<get_no_modify> and
1635 C<get_ppaddr> have been marked deprecated.
1639 C<hv_free_ent> has been marked as internal API.
1643 C<save_pushptr>, C<save_pushptrptr>, and C<save_pushi32ptr> have been marked
1648 New bool related functions and macros have been added to complement the new
1649 bool type introduced in 5.36:
1655 =item L<C<newSVbool(const bool bool_val)>|perlapi/newSVbool>
1657 =item L<C<newSV_true()>|perlapi/newSV_true>
1659 =item L<C<newSV_false()>|perlapi/newSV_false>
1661 =item L<C<sv_set_true(SV *sv)>|perlapi/sv_set_true>
1663 =item L<C<sv_set_false(SV *sv)>|perlapi/sv_set_false>
1665 =item L<C<sv_set_bool(SV *sv, const bool bool_val)>|perlapi/sv_set_bool>
1673 =item L<C<SvIandPOK(sv)>|perlapi/SvIandPOK>
1675 =item L<C<SvIandPOK_off(sv)>|perlapi/SvIandPOK_off>
1677 =item L<C<SvIandPOK_on>|perlapi/SvIandPOK_on>
1683 Perl is no longer manipulating the C<environ> array directly. The variable
1684 C<PL_use_safe_putenv> has been removed and C<PERL_USE_SAFE_PUTENV> is always
1685 defined. This means XS modules can now call C<setenv> and C<putenv> without
1686 causing segfaults. [L<perl #19399|https://github.com/Perl/perl5/issues/19399>]
1690 Internal C API functions are now hidden with C<__attribute__((hidden))> on the
1691 platforms that support it. This means they are no longer callable from XS
1692 modules on those platforms.
1694 It should be noted that those functions have always been hidden on Windows. This
1695 change merely brings that to the other platforms.
1696 [L<perl #19655|https://github.com/Perl/perl5/pull/19655>]
1700 New formatting symbols were added for printing values declared as U32 or
1705 =item I32df -- Like %d
1707 =item U32of -- Like %o
1709 =item U32uf -- Like %u
1711 =item U32xf -- Like %x
1713 =item U32Xf -- Like %X
1717 These are used in the same way already existing similar symbols, such as
1718 C<IVdf>, are used. See L<perlapi/I/O Formats>.
1722 new 'HvHasAUX' macro
1726 regexec.c: Add some branch predictions reorder conds
1730 locale: Change macro name to be C conformant
1734 Rename the C<PADNAMEt_*> constants to C<PADNAMEf_*>
1738 Changes all the API macros that retrieve a PV into a call to an
1739 inline function so as to evaluate the parameter just once.
1743 regexec.c: multiple code refactor to make the code more readable
1747 perl.h: Change macro name to be C conformant
1748 (remove leading _ from NOT_IN_NUMERIC macros)
1752 regcomp.h: add new C<BITMAP_BIT> macro in addition to the existing C<BITMAP_BYTE>
1753 and C<BITMAP_TEST> ones.
1757 Create new regnode type ANYOFH.
1758 populate_ANYOF_from_invlist was renamed to populate_bitmap_from_invlist
1762 regex: Refactor bitmap vs non-bitmap of qr/[]/
1766 regcomp.c: add new functions to convert from an inversion list to a bitmap (and vice versa)
1767 C<populate_bitmap_from_invlist> and C<populate_invlist_from_bitmap>.
1771 Add C<newAVav()> to create an AV from an existing AV.
1772 Add C<newAVhv()> to create an AV using keys and values from an existing HV.
1776 Fix definition of C<Perl_atof>.
1780 Fix undefined behavior with overflow related OPTIMIZE_INFTY and delta
1785 Fix regnode pointer alignment issue in F<regcomp.h>.
1789 The C<CVf_METHOD> CV flag and associated C<CvMETHOD> macro has been renamed to
1790 C<CVf_NOWARN_AMBIGUOUS> and C<CvNOWARN_AMBIGUOUS>. This closer reflects its
1791 actual behaviour (it suppresses a warning that would otherwise be generated
1792 about ambiguous names), in order to be less confusing with a possible upcoming
1797 The C<OPf_SPECIAL> flag is no longer set on the C<OP_ENTERSUB> op
1798 constructed to call the C<VERSION>, C<import> and C<unimport> methods
1799 as part of a C<use> statement and attribute application, nor when
1800 assigning to an C<:lvalue> subroutine.
1804 A new CV flag C<CVf_REFCOUNTED_ANYSV> has been added, which indicates that the
1805 CV is an XSUB and stores an SV pointer in the C<CvXSUBANY.any_sv> union field.
1806 Perl core operations such as cloning or destroying the CV will maintain the
1807 reference count of the pointed-to SV, destroying it when required.
1811 A new API function L<perlapi/C<Perl_localeconv>> is added. This is the
1812 same as L<C<POSIX::localeconv>|POSIX/localeconv> (returning a hash of
1813 the C<localeconv()> fields), but directly callable from XS code.
1817 A new API function, L<perlapi/C<Perl_langinfo8>> is added. This is the
1818 same as plain L<perlapi/C<Perl_langinfo>>, but with an extra parameter
1819 that allows the caller to simply and reliably know if the returned
1824 We have introduced a limit on the number of nested C<eval EXPR>/C<BEGIN>
1825 blocks and C<require>/C<BEGIN> (and thus C<use> statements as well) to
1826 prevent C stack overflows. This variable can also be used to forbid
1827 C<BEGIN> blocks from executing during C<eval EXPR> compilation. The
1828 limit defaults to C<1000> but can be overridden by setting the
1829 C<${^MAX_NESTED_EVAL_BEGIN_BLOCKS}> variable. The default itself can be
1830 changed at compile time with
1832 -Accflags='-DPERL_MAX_NESTED_EVAL_BEGIN_BLOCKS_DEFAULT=12345'
1834 Note that this value relates to the size of your C stack and if you
1835 choose an inappropriately large value Perl may segfault, be conservative
1836 about what you choose.
1840 A new magic type C<PERL_MAGIC_extvalue> has been added. This is available for
1841 use like C<PERL_MAGIC_ext>, but is a value magic: upon localization the new
1842 value will not be magical.
1846 The C<SSNEW()>, C<SSNEWt()>, C<SSNEWa()> and C<SSNEWat()> APIs now
1847 return a C<SSize_t> value. The C<SSPTR()> and C<SSPTRt()> macros now
1848 expect a C<SSize_t> parameter, and enforce that on debugging builds.
1853 Filenames in cops are now refcounted under threads.
1854 Under threads we were copying the filenames into each opcode. This is because in
1855 theory opcodes created in one thread can be destroyed in another.
1856 The change adds a new struct/type RCPV, which is a refcounted
1857 string using shared memory. This is implemented in such a way that code
1858 that previously used a char * can continue to do so, as the refcounting
1859 data is located a specific offset before the char * pointer itself.
1863 Added HvNAMEf and HvNAMEf_QUOTEDPREFIX special formats. They take an HV *
1864 as an argument and use C<HvNAME()> and related macros to determine the string,
1865 its length, and whether it is utf8.
1869 The underlying C<Perl_dowantarray> function implementing the
1870 long-deprecated L<C<GIMME>|perlapi/GIMME> macro has been marked as
1871 deprecated, so that use of the macro emits a compile-time warning.
1872 C<GIMME> has been documented as deprecated in favour of
1873 L<C<GIMME_V>|perlapi/GIMME_V> since Perl v5.6.0, but had not
1874 previously issued a warning.
1878 The API function L<perlapi/utf8_length> is now more efficient.
1882 Added C<SAVERCPV()> and C<SAVEFREERCPV()> for better support for working
1883 with C<RCPV> (reference counted string/pointer value) structures which
1884 currently are used in opcodes to share filename and warning bit data in
1885 a memory efficient manner.
1889 Added C<MORTALSVFUNC_SV()> and C<MORTALDESTRUCTOR_SV()> macros, which
1890 make it possible to create a destructor which is fired at the end of
1891 the current statement. This uses the C<PERL_MAGIC_destruct> magic to
1892 use "free" magic to trigger an action when a variable is freed. The
1893 action can be specified as a C function or as a Perl code reference.
1897 Added the C<%{^HOOK}> api and related C<PERL_MAGIC_hook> and
1898 C<PERL_MAGIC_hookelem> for providing ways to hook selected perl functions
1899 which for one reason or another are problematic to wrap with a customized
1904 Added support for C<${^HOOK}{require__before}> which can be used to
1905 rewrite the filename that C<require> will try to load, and also to block
1906 C<require> from loading a specific module, even via fully qualified
1907 filename. The hook can also be used to perform "pre-require" and
1908 "post-require" actions.
1912 Added support for C<${^HOOK}{require__after}> which can be used to
1913 track what modules have been required after the fact.
1917 Regular expression opcodes (regops) now use a standardized structure
1918 layout that uses unions to expose data in different format. This means
1919 it should be much easier to extend or modify regops to use more memory.
1920 This has been used to make a number of regops track how many parens
1925 =head1 Selected Bug Fixes
1931 Avoid recursion and stack overflow parsing 'pack' template
1933 [L<GH #16319|https://github.com/Perl/perl5/issues/16319>]
1937 An eval() as the last statement in a regex code block could trigger an
1938 interpreter panic; e.g.
1940 /(?{ ...; eval {....}; })/
1942 [L<GH #19680|https://github.com/Perl/perl5/issues/19680>]
1946 Disabling the C<bareword_filehandles> feature no longer treats C<< print
1947 Class->method >> as an error. [L<github #19704|https://github.com/Perl/perl5/issues/19704>]
1951 When a Perl subroutine tail-calls an XS subroutine using C<goto &xs_sub>,
1952 the XS subroutine can now correctly determine its calling context.
1953 Previously it was always reported as scalar.
1955 In addition, where the Perl subroutine is freed at the same time:
1957 sub foo { *foo = sub {}; goto &xs_sub }
1959 this formerly could lead to crashes if the XS subroutine tried to use the
1960 value of C<PL_op>, since this was being set to NULL. This is now fixed.
1962 [L<github #19936|https://github.com/Perl/perl5/issues/19936>]
1966 setsockopt() now uses the mechanism added in 5.36 to better
1967 distinguish between numeric and string values supplied as the
1968 C<OPTVAL> parameter. [L<github #18761|https://github.com/Perl/perl5/issues/18761>]
1972 4-argument C<select()> now rejects strings with code points above
1973 255. Additionally, for code points 128-255, this operator will now always
1974 give the corresponding octet to the OS, regardless of how Perl stores
1975 such code points in memory. (Previously Perl leaked its internal string
1976 storage to the OS.) [L<github #19882|https://github.com/Perl/perl5/issues/19882>]
1980 Fix panic issue from C<val {} inside /(?{...})/> [L<github #19390|https://github.com/Perl/perl5/issues/19390>]
1984 Fix multiple compiler warnings from regexp.c., locale.c [L<github #19915|https://github.com/Perl/perl5/issues/19915>]
1988 Fix a bug with querying locales on platforms that don't have LC_NUMERIC
1989 [L<github #19890|https://github.com/Perl/perl5/issues/19890>]
1993 Prevent undefined behaviour in C<S_maybe_multideref()>.
1997 Avoid signed integer overflow in C<use integer> ops.
2001 Avoid adding an offset to a NULL pointer in C<hv_delete_common>.
2005 PerlIO::get_layers will now accept IO references too
2007 Previously it would only take glob references or names of globs. Now it will
2008 also accept IO references.
2012 Fixes to memory handling for C<PL_splitstr>:
2018 If a thread was created the allocated string would be freed twice.
2022 If two C<-F> switches were supplied the memory allocated for the first
2023 switch wouldn't be freed.
2029 Correctly handle C<OP_ANONCODE> ops generated by CPAN modules that
2030 don't include the OPf_REF flag when propagating lvalue context.
2031 L<[GH #20532]|https://github.com/Perl/perl5/pull/20532>
2035 L<POSIX::strxfrm|POSIX/strxfrm> now uses the C<LC_CTYPE> locale category
2036 to specify its collation, ignoring any differing C<LC_COLLATE>. It
2037 doesn't make sense for a string to be encoded in one locale (say,
2038 ISO-8859-6, Arabic) and to collate it based on another (like ISO-8859-7,
2039 Greek). Perl assumes that the current C<LC_CTYPE> locale correctly
2040 represents the encoding, and collates accordingly.
2042 Also, embedded C<NUL> characters are now allowed in the input.
2044 If locale collation is not enabled on the platform (C<LC_COLLATE>), the
2045 input is returned unchanged.
2049 Double FETCH during stringification of tied scalars returning an
2050 overloaded object have been fixed. The FETCH method should only be
2051 called once, but prior to this release was actually called twice.
2052 L<[GH #20574]|https://github.com/Perl/perl5/pull/20574>
2056 Writing to a magic variables associated with the selected output
2057 handle, C<$^>, C<$~>, C<$=>, C<$-> and C<$%>, no longer crashes perl
2058 if the IO object has been cleared from the selected output
2059 handle. [L<GH #20733|https://github.com/Perl/perl5/issues/20733>]
2063 Redefining a C<use constant> list constant with C<use constant> now
2064 properly warns. This changes the behaviour of C<use constant> but is
2065 a core change, not a change to F<constant.pm>. [L<GH #20742|https://github.com/Perl/perl5/issues/20742>]
2069 Redefining a C<use constant> list constant with an empty prototype
2070 constant sub would result in an assertion failure. [L<GH #20742|https://github.com/Perl/perl5/issues/20742>]
2074 Fixed a regression where the C<INC> method for objects in C<@INC>
2075 would not be resolved by C<AUTOLOAD>, while it was in 5.36. The
2076 C<INCDIR> method for objects in C<@INC> cannot be resolved by
2077 C<AUTOLOAD> as C<INC> would have been resolved first. [L<GH #20665|https://github.com/Perl/perl5/issues/20665>]
2081 C<$SIG{__DIE__}> will now be called from eval when the code dies during
2082 compilation regardless of how it dies. This means that code expecting to
2083 be able to upgrade C<$@> into an object will be called consistently. In
2084 earlier versions of perl C<$SIG{__DIE__}> would not be called for
2085 certain compilation errors, for instance undeclared variables. For other
2086 errors it might be called if there were more than a certain number of
2087 errors, but not if there were less. Now you can expect that it will be
2088 called in every case.
2092 Compilation of code with errors used to inconsistently stop depending on
2093 the count and type of errors encountered. The intent was that after 10
2094 errors compilation would halt, but bugs in this logic meant that certain
2095 types of error would be counted, but would not trigger the threshold
2096 check to stop compilation. Other errors would. With this release after
2097 at most 10 errors compilation will terminate, regardless of what type of
2100 Note that you can change the maximum count by defining
2101 C<PERL_STOP_PARSING_AFTER_N_ERRORS> to be something else during the
2102 configuration process. For instance
2104 ./Configure ... -Accflags='-DPERL_STOP_PARSING_AFTER_N_ERRORS=100'
2106 would allow up to 100 errors.
2110 The API function L<perlapi/my_snprintf> now prints a non-dot decimal
2111 point if the perl code it ultimately is called from is in the scope of
2112 C<use locale> and the locale in effect calls for that.
2116 A number of bugs related to capture groups in quantified groups in regular
2117 expression have been fixed, especially in alternations. For example in
2120 "foobazfoobar" =~ /((foo)baz|foo(bar))+/
2122 the regex variable C<$2> will not be "foo" as it once was, it will be undef.
2126 Bugs with regex backreference operators that are inside of a capture
2127 group have been fixed. For instance:
2129 "xa=xaaa" =~ /^(xa|=?\1a){2}\z/
2131 will now correctly not match. [L<GH #10073|https://github.com/Perl/perl5/issues/10073>]
2135 C<SSGROW()> and C<SSCHECK()> have been reworked to ensure that the requested
2136 space is actually allocated. C<SSCHECK()> is now an alias for C<SSGROW()>.
2140 =head1 Acknowledgements
2142 Perl 5.38.0 represents approximately 12 months of development since Perl
2143 5.36.0 and contains approximately 290,000 lines of changes across 1,500
2144 files from 100 authors.
2146 Excluding auto-generated files, documentation and release tools, there were
2147 approximately 190,000 lines of changes to 970 .pm, .t, .c and .h files.
2149 Perl continues to flourish into its fourth decade thanks to a vibrant
2150 community of users and developers. The following people are known to have
2151 contributed the improvements that became Perl 5.38.0:
2153 Alex, Alexander Nikolov, Alex Davies, Andreas König, Andrew Fresh, Andrew
2154 Ruthven, Andy Lester, Aristotle Pagaltzis, Arne Johannessen, A. Sinan Unur,
2155 Bartosz Jarzyna, Bart Van Assche, Benjamin Smith, Bram, Branislav
2156 Zahradník, Brian Greenfield, Bruce Gray, Chad Granum, Chris 'BinGOs'
2157 Williams, chromatic, Clemens Wasser, Craig A. Berry, Dagfinn Ilmari
2158 Mannsåker, Dan Book, danielnachun, Dan Jacobson, Dan Kogai, David Cantrell,
2159 David Golden, David Mitchell, E. Choroba, Ed J, Ed Sabol, Elvin Aslanov,
2160 Eric Herman, Felipe Gasper, Ferenc Erki, Firas Khalil Khana, Florian Weimer,
2161 Graham Knop, Håkon Hægland, Harald Jörg, H.Merijn Brand, Hugo van der
2162 Sanden, James E Keenan, James Raspass, jkahrman, Joe McMahon, Johan Vromans,
2163 Jonathan Stowe, Jon Gentle, Karen Etheridge, Karl Williamson, Kenichi
2164 Ishigaki, Kenneth Ölwing, Kurt Fitzner, Leon Timmermans, Li Linjie, Loren
2165 Merritt, Lukas Mai, Marcel Telka, Mark Jason Dominus, Mark Shelor, Matthew
2166 Horsfall, Matthew O. Persico, Mattia Barbon, Max Maischein, Mohammad S
2167 Anwar, Nathan Mills, Neil Bowers, Nicholas Clark, Nicolas Mendoza, Nicolas
2168 R, Paul Evans, Paul Marquess, Peter John Acklam, Peter Levine, Philippe
2169 Bruhat (BooK), Reini Urban, Renee Baecker, Ricardo Signes, Richard Leach,
2170 Russ Allbery, Scott Baker, Sevan Janiyan, Sidney Markowitz, Sisyphus, Steve
2171 Hay, TAKAI Kousuke, Todd Rinaldo, Tomasz Konojacki, Tom Stellard, Tony Cook,
2172 Tsuyoshi Watanabe, Unicode Consortium, vsfos, Yves Orton, Zakariyya Mughal,
2175 The list above is almost certainly incomplete as it is automatically
2176 generated from version control history. In particular, it does not include
2177 the names of the (very much appreciated) contributors who reported issues to
2178 the Perl bug tracker.
2180 Many of the changes included in this version originated in the CPAN modules
2181 included in Perl's core. We're grateful to the entire CPAN community for
2182 helping Perl to flourish.
2184 For a more complete list of all of Perl's historical contributors, please
2185 see the F<AUTHORS> file in the Perl source distribution.
2187 =head1 Reporting Bugs
2189 If you find what you think is a bug, you might check the perl bug database
2190 at L<https://github.com/Perl/perl5/issues>. There may also be information at
2191 L<http://www.perl.org/>, the Perl Home Page.
2193 If you believe you have an unreported bug, please open an issue at
2194 L<https://github.com/Perl/perl5/issues>. Be sure to trim your bug down to a
2195 tiny but sufficient test case.
2197 If the bug you are reporting has security implications which make it
2198 inappropriate to send to a public issue tracker, then see
2199 L<perlsec/SECURITY VULNERABILITY CONTACT INFORMATION>
2200 for details of how to report the issue.
2204 If you wish to thank the Perl 5 Porters for the work we had done in Perl 5,
2205 you can do so by running the C<perlthanks> program:
2209 This will send an email to the Perl 5 Porters list with your show of thanks.
2213 The F<Changes> file for an explanation of how to view exhaustive details on
2216 The F<INSTALL> file for how to build Perl.
2218 The F<README> file for general stuff.
2220 The F<Artistic> and F<Copying> files for copyright information.