This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge perl5252delta.pod
[perl5.git] / pod / perl5260delta.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 perl5260delta - what is new for perl v5.26.0
6
7 =head1 DESCRIPTION
8
9 This document describes the differences between the 5.24.0 release and the
10 5.26.0 release.
11
12 =head1 Core Enhancements
13
14 =head2 Perl can now do default collation in UTF-8 locales on platforms
15 that support it
16
17 Some platforms natively do a reasonable job of collating and sorting in
18 UTF-8 locales.  Perl now works with those.  For portability and full
19 control, L<Unicode::Collate> is still recommended, but now you may
20 not need to do anything special to get good-enough results, depending on
21 your application.  See
22 L<perllocale/Category C<LC_COLLATE>: Collation: Text Comparisons and Sorting>.
23
24 =head2 Better locale collation of strings containing embedded C<NUL>
25 characters
26
27 In locales that have multi-level character weights, these are now
28 ignored at the higher priority ones.  There are still some gotchas in
29 some strings, though.  See
30 L<perllocale/Collation of strings containing embedded C<NUL> characters>.
31
32 =head2 Lexical subroutines are no longer experimental
33
34 Using the C<lexical_subs> feature no longer emits a warning. Existing
35 code that disables the C<experimental::lexical_subs> warning category
36 that the feature previously used will continue to work. The
37 C<lexical_subs> feature has no effect; all Perl code can use lexical
38 subroutines, regardless of what feature declarations are in scope.
39
40 =head2 C<CORE> subroutines for hash and array functions callable via
41 reference
42
43 The hash and array functions in the C<CORE> namespace--C<keys>, C<each>,
44 C<values>, C<push>, C<pop>, C<shift>, C<unshift> and C<splice>--, can now
45 be called with ampersand syntax (C<&CORE::keys(\%hash>) and via reference
46 (C<< my $k = \&CORE::keys; $k->(\%hash) >>).  Previously they could only be
47 used when inlined.
48
49 =head2 POSIX::tmpnam() has been removed
50
51 The fundamentally unsafe C<tmpnam()> interface was deprecated in
52 Perl 5.22.0 and has now been removed.  In its place you can use
53 for example the L<File::Temp> interfaces.
54
55 =head2 require ::Foo::Bar is now illegal.
56
57 Formerly, C<require ::Foo::Bar> would try to read F</Foo/Bar.pm>. Now any
58 bareword require which starts with a double colon dies instead.
59
60 =head2 Unescaped literal C<"{"> characters in regular expression
61 patterns are no longer permissible
62
63 You have to now say something like C<"\{"> or C<"[{]"> to specify to
64 match a LEFT CURLY BRACKET.  This will allow future extensions to the
65 language.  This restriction is not enforced, nor are there current plans
66 to enforce it, if the C<"{"> is the first character in the pattern.
67
68 These have been deprecated since v5.16, with a deprecation message
69 displayed starting in v5.22.
70
71 =head2 Literal control character variable names are no longer permissible
72
73 A variable name may no longer contain a literal control character under
74 any circumstances.  These previously were allowed in single-character
75 names on ASCII platforms, but have been deprecated there since Perl
76 v5.20.  This affects things like C<$I<\cT>>, where I<\cT> is a literal
77 control (such as a C<NAK> or C<NEGATIVE ACKNOWLEDGE> character) in the
78 source code.
79
80 =head2 C<qr//xx> is no longer permissible
81
82 Using more than one C</x> regular expression pattern modifier on a
83 single pattern is now forbidden.  This is to allow a future enhancement
84 to the language.  This usage has been deprecated since v5.22.
85
86 =head2 C<NBSP> is no longer permissible in C<\N{...}>
87
88 The name of a character may no longer contain non-breaking spaces.  It
89 has been deprecated to do so since Perl v5.22.
90
91 =head1 Security
92
93 =head2 C<-Di> switch is now required for PerlIO debugging output
94
95 Previously PerlIO debugging output would be sent to the file specified
96 by the C<PERLIO_DEBUG> environment variable if perl wasn't running
97 setuid and the C<-T> or C<-t> switches hadn't been parsed yet.
98
99 If perl performed output at a point where it hadn't yet parsed its
100 switches this could result in perl creating or overwriting the file
101 named by C<PERLIO_DEBUG> even when the C<-T> switch had been supplied.
102
103 Perl now requires the C<-Di> switch to produce PerlIO debugging
104 output.  By default this is written to C<stderr>, but can optionally
105 be redirected to a file by setting the C<PERLIO_DEBUG> environment
106 variable.
107
108 If perl is running setuid or the C<-T> switch has supplied
109 C<PERLIO_DEBUG> is ignored and the debugging output is sent to
110 C<stderr> as for any other C<-D> switch.
111
112 =head1 Incompatible Changes
113
114 =head2 C<keys> returned from an lvalue subroutine
115
116 C<keys> returned from an lvalue subroutine can no longer be assigned
117 to in list context.
118
119     sub foo : lvalue { keys(%INC) }
120     (foo) = 3; # death
121     sub bar : lvalue { keys(@_) }
122     (bar) = 3; # also an error
123
124 This makes the lvalue sub case consistent with C<(keys %hash) = ...> and
125 C<(keys @_) = ...>, which are also errors.  [perl #128187]
126
127 =head1 Performance Enhancements
128
129 =over 4
130
131 =item *
132
133 Bareword constant strings are now permitted to take part in constant
134 folding. They were originally exempted from constant folding in August 1999,
135 during the development of Perl 5.6, to ensure that C<use strict "subs">
136 would still apply to bareword constants. That has now been accomplished a
137 different way, so barewords, like other constants, now gain the performance
138 benefits of constant folding.
139
140 This also means that void-context warnings on constant expressions of
141 barewords now report the folded constant operand, rather than the operation;
142 this matches the behaviour for non-bareword constants.
143
144 =back
145
146 =head1 Modules and Pragmata
147
148 =head2 Updated Modules and Pragmata
149
150 =over 4
151
152 =item *
153
154 L<POSIX> has been upgraded from version 1.65 to 1.69. This remedies several
155 defects in making its symbols exportable. [perl #127821]
156 The C<POSIX::tmpnam()> interface has been removed,
157 see L</"POSIX::tmpnam() has been removed">.
158 Trying to import POSIX subs that have no real implementations
159 (like C<POSIX::atend()>) now fails at import time, instead of
160 waiting until runtime.
161
162 =item *
163
164 L<threads> has been upgraded from version 2.07 to 2.08. Compatibility
165 with 5.8 has been restored.
166
167 =back
168
169 =head1 Documentation
170
171 =head2 Changes to Existing Documentation
172
173 =head3 L<perlcommunity>
174
175 =over 4
176
177 =item *
178
179 All references to Usenet have been removed.
180
181 =back
182
183 =head3 L<perldelta>
184
185 =over 4
186
187 =item *
188
189 All references to Usenet have been removed.
190
191 =back
192
193 =head3 L<perllocale>
194
195 =over 4
196
197 =item *
198
199 Document NUL collation handling.
200
201 =back
202
203 =head3 L<perlmodinstall>
204
205 =over 4
206
207 =item *
208
209 All references to Usenet have been removed.
210
211 =back
212
213 =head3 L<perlmodlib>
214
215 =over 4
216
217 =item *
218
219 Updated the mirror list.
220
221 =item *
222
223 All references to Usenet have been removed.
224
225 =back
226
227 =head3 L<perlnewmod>
228
229 =over 4
230
231 =item *
232
233 All references to Usenet have been removed.
234
235 =back
236
237 =head3 L<perlsec>
238
239 =over 4
240
241 =item *
242
243 Fixed link to Crosby paper on hash complexity attack.
244
245 =back
246
247 =head1 Diagnostics
248
249 =head2 New Diagnostics
250
251 =head3 New Errors
252
253 =over 4
254
255 =item *
256
257 L<Version control conflict marker|perldiag/"Version control conflict marker">
258
259 (F) The parser found a line starting with C<E<lt><<<<<<>,
260 C<E<gt>E<gt>E<gt>E<gt>E<gt>E<gt>E<gt>>, or C<=======>. These may be left by a
261 version control system to mark conflicts after a failed merge operation.
262
263 =item *
264
265 L<%s: command not found|perldiag/"%s: command not found">
266
267 (A) You've accidentally run your script through B<bash> or another shell
268 instead of Perl.  Check the #! line, or manually feed your script into
269 Perl yourself.  The #! line at the top of your file could look like:
270
271   #!/usr/bin/perl
272
273 =item *
274
275 L<%s: command not found: %s|perldiag/"%s: command not found: %s">
276
277 (A) You've accidentally run your script through B<zsh> or another shell
278 instead of Perl.  Check the #! line, or manually feed your script into
279 Perl yourself.  The #! line at the top of your file could look like:
280
281   #!/usr/bin/perl
282
283 =item *
284
285 L<Unescaped left brace in regex is deprecated here, passed through in regex; marked by S<<-- HERE> in mE<sol>%sE<sol>|perldiag/"Unescaped left brace in regex is deprecated here, passed through in regex; marked by S<<-- HERE> in m/%s/">
286
287 Unescaped left braces are already illegal in some contexts in regular
288 expression patterns, but, due to an oversight, no deprecation warning
289 was raised in other contexts where they are intended to become illegal.
290 This warning is now raised in these contexts.
291
292 =item *
293
294 L<Bareword in require contains "%s"|perldiag/"Bareword in require contains "%s"">
295
296 =item *
297
298 L<Bareword in require maps to empty filename|perldiag/"Bareword in require maps to empty filename">
299
300 =item *
301
302 L<Bareword in require maps to disallowed filename "%s"|perldiag/"Bareword in require maps to disallowed filename "%s"">
303
304 =item *
305
306 L<Bareword in require must not start with a double-colon: "%s"|perldiag/"Bareword in require must not start with a double-colon: "%s"">
307
308 =back
309
310 =head2 Changes to Existing Diagnostics
311
312 =over 4
313
314 =item *
315
316 L<Unescaped left brace in regex is illegal here in regex; marked by S<<-- HERE> in mE<sol>%sE<sol>|perldiag/"Unescaped left brace in regex is illegal here in regex; marked by S<<-- HERE> in m/%s/">
317
318 The word "here" has been added to the message that was raised in
319 v5.25.1.  This is to indicate that there are contexts in which unescaped
320 left braces are not (yet) illegal.
321
322 =item *
323
324 Code like C<$x = $x . "a"> was incorrectly failing to yield a
325 L<use of uninitialized value|perldiag/"Use of uninitialized value%s">
326 warning when C<$x> was a lexical variable with an undefined value. That has
327 now been fixed. [perl #127877]
328
329 =item *
330
331 When the error "Experimental push on scalar is now forbidden" is raised for
332 the hash functions C<keys>, C<each>, and C<values>, it is now followed by
333 the more helpful message, "Type of arg 1 to whatever must be hash or
334 array". [perl #127976]
335
336 =item *
337
338 C<undef *_; shift> or C<undef *_; pop> inside a subroutine, with no
339 argument to C<shift> or C<pop>, began crashing in Perl 5.14.0, but has now
340 been fixed.
341
342 =item *
343
344 C<< "string$scalar-E<gt>$*" >> now correctly prefers concat overloading to
345 string overloading if C<< $scalar-E<gt>$* >> returns an overloaded object,
346 bringing it into consistency with C<$$scalar>.
347
348 =item *
349
350 C<< /@0{0*-E<gt>@*/*0 >> and similar contortions used to crash, but no longer
351 do, but merely produce a syntax error. [perl #128171]
352
353 =item *
354
355 C<do> or C<require> with a reference or typeglob which, when stringified,
356 contains a null character started crashing in Perl 5.20.0, but has now been
357 fixed. [perl #128182]
358
359 =back
360
361 =head1 Utility Changes
362
363 =head2 L<perlbug>
364
365 =over 4
366
367 =item *
368
369 Long lines in the message body are now wrapped at 900 characters, to stay
370 well within the 1000-character limit imposed by SMTP mail transfer agents.
371 This is particularly likely to be important for the list of arguments to
372 C<Configure>, which can readily exceed the limit if, for example, it names
373 several non-default installation paths. This change also adds the first unit
374 tests for perlbug. [perl #128020]
375
376 =back
377
378 =head1 Configuration and Compilation
379
380 =over 4
381
382 =item *
383
384 F<make_ext.pl> no longer updates a module's F<pm_to_blib> file when no
385 files require updates.  This could cause dependencies, F<perlmain.c>
386 in particular, to be rebuilt unnecessarily.  [perl #126710]
387
388 =item *
389
390 The output of C<perl -V> has been reformatted so that each configuration
391 and compile-time option is now listed one per line, to improve
392 readability.
393
394 =item *
395
396 C<Configure> now builds C<miniperl> and C<generate_uudmap> if you
397 invoke it with C<-Dusecrosscompiler> but not C<-Dtargethost=somehost>.
398 This means you can supply your target platform C<config.sh>, generate
399 the headers and proceed to build your cross-target perl.  [perl #127234]
400
401 =item *
402
403 Builds with C<-Accflags=-DPERL_TRACE_OPS> now only dump the operator
404 counts when the environment variable C<PERL_TRACE_OPS> to be set to a
405 non-zero integer.  This allows C<make test> to pass on such a build.
406
407 =item *
408
409 When building with GCC 6 and link-time optimization (the C<-flto> option to
410 C<gcc>), C<Configure> was treating all probed symbols as present on the
411 system, regardless of whether they actually exist. This has been fixed.
412 [perl #128131]
413
414 =item *
415
416 The F<t/test.pl> library is used for internal testing of Perl itself, and
417 also copied by several CPAN modules. Some of those modules must work on
418 older versions of Perl, so F<t/test.pl> must in turn avoid newer Perl
419 features. Compatibility with Perl 5.8 was inadvertently removed some time
420 ago; it has now been restored. [perl #128052]
421
422 =item *
423
424 The build process no longer emits an extra blank line before building each
425 "simple" extension (those with only F<*.pm> and F<*.pod> files).
426
427 =back
428
429 =head1 Testing
430
431 =over 4
432
433 =item *
434
435 F<t/harness> now tries really hard not to run tests outside of the Perl
436 source tree. [perl #124050]
437
438 =back
439
440 =head1 Internal Changes
441
442 =over 4
443
444 =item *
445
446 Perl no longer panics when switching into some locales on machines with
447 buggy C<strxfrm()> implementations in their libc. [perl #121734]
448
449 =item *
450
451 Perl is now built with the C<PERL_OP_PARENT> compiler define enabled by
452 default. To disable it, use the C<PERL_NO_OP_PARENT> compiler define.
453 This flag alters how the C<op_sibling> field is used in C<OP> structures,
454 and has been available optionally since perl 5.22.0.
455
456 See L<perl5220delta/"Internal Changes"> for more details of what this
457 build option does.
458
459 =back
460
461 =head1 Selected Bug Fixes
462
463 =over 4
464
465 =item *
466
467 C< until ($x = 1) { ... } > and C< ... until $x = 1 > now properly
468 warn when syntax warnings are enabled.  [perl #127333]
469
470 =item *
471
472 socket() now leaves the error code returned by the system in C<$!> on
473 failure.  [perl #128316]
474
475 =item *
476
477 Assignment variants of any bitwise ops under the C<bitwise> feature would
478 crash if the left-hand side was an array or hash.  [perl #128204]
479
480 =item *
481
482 C<require> followed by a single colon (as in C<foo() ? require : ...> is
483 now parsed correctly as C<require> with implicit $_, rather than
484 C<require "">.  [perl #128307]
485
486 =item *
487
488 Scalar C<keys %hash> can now be assigned to consistently in all scalar
489 lvalue contexts.  Previously it worked for some contexts but not others.
490
491 =item *
492
493 List assignment to C<vec> or C<substr> with an array or hash for its first
494 argument used to result in crashes or "Can't coerce" error messages at run
495 time, unlike scalar assignment, which would give an error at compile time.
496 List assignment now gives a compile-time error, too.  [perl #128260]
497
498 =item *
499
500 Expressions containing an C<&&> or C<||> operator (or their synonyms C<and>
501 and C<or>) were being compiled incorrectly in some cases. If the left-hand
502 side consisted of either a negated bareword constant or a negated C<do {}>
503 block containing a constant expression, and the right-hand side consisted of
504 a negated non-foldable expression, one of the negations was effectively
505 ignored. The same was true of C<if> and C<unless> statement modifiers,
506 though with the left-hand and right-hand sides swapped. This long-standing
507 bug has now been fixed. [perl #127952]
508
509 =item *
510
511 C<reset> with an argument no longer crashes when encountering stash entries
512 other than globs. [perl #128106]
513
514 =item *
515
516 Assignment of hashes to, and deletion of, typeglobs named C<*::::::> no
517 longer causes crashes. [perl #128086]
518
519 =back
520
521 =head1 Known Problems
522
523 =over 4
524
525 =item *
526
527 Some modules have been broken by the L<context stack rework|/Internal Changes>.
528 These modules were relying on non-guaranteed implementation details in perl.
529 Their maintainers have been informed, and should contact perl5-porters for
530 advice if needed.  Below is a subset of these modules:
531
532 =over 4
533
534 =item * L<Algorithm::Permute>
535
536 =item * L<Coro>
537
538 L<Coro> and perl v5.22.0 were already incompatible due to a change in the perl,
539 and the reworking on the perl context stack creates a further incompatibility.
540 perl5-porters has L<discussed the issue on the mailing
541 list|http://www.nntp.perl.org/group/perl.perl5.porters/2016/05/msg236174.html>.
542
543 =item * L<Data::Alias>
544
545 =item * L<RPerl>
546
547 =item * L<Scope::Upper>
548
549 =item * L<TryCatch>
550
551 =back
552
553 =item *
554
555 The module L<lexical::underscore> no longer works on perl v5.24.0, because perl
556 no longer has a lexical C<$_>!
557
558 =item *
559
560 C<mod_perl> has been patched for compatibility for v5.22.0 and later but no
561 release has been made.  The relevant patch (and other changes) can be found in
562 their source code repository, L<mirrored at
563 GitHub|https://github.com/apache/mod_perl/commit/82827132efd3c2e25cc413c85af61bb63375da6e>.
564
565 =back
566
567 =head1 Acknowledgements
568
569 XXX Generate this with:
570
571   perl Porting/acknowledgements.pl v5.24.0..HEAD
572
573 =head1 Reporting Bugs
574
575 If you find what you think is a bug, you might check the articles recently
576 posted to the comp.lang.perl.misc newsgroup and the perl bug database at
577 L<https://rt.perl.org/> .  There may also be information at
578 L<http://www.perl.org/> , the Perl Home Page.
579
580 If you believe you have an unreported bug, please run the L<perlbug> program
581 included with your release.  Be sure to trim your bug down to a tiny but
582 sufficient test case.  Your bug report, along with the output of C<perl -V>,
583 will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
584
585 If the bug you are reporting has security implications which make it
586 inappropriate to send to a publicly archived mailing list, then see
587 L<perlsec/SECURITY VULNERABILITY CONTACT INFORMATION>
588 for details of how to report the issue.
589
590 =head1 SEE ALSO
591
592 The F<Changes> file for an explanation of how to view exhaustive details on
593 what changed.
594
595 The F<INSTALL> file for how to build Perl.
596
597 The F<README> file for general stuff.
598
599 The F<Artistic> and F<Copying> files for copyright information.
600
601 =cut