This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bump VERSIONs in XS-APItest and XS-APItest-KeywordRPN
[perl5.git] / pod / perldelta.pod
CommitLineData
4c793fe3
FR
1=encoding utf8
2
3=head1 NAME
4
4c793fe3
FR
5perldelta - what is new for perl v5.13.5
6
7=head1 DESCRIPTION
8
9This document describes differences between the 5.13.4 release and
10the 5.13.5 release.
11
12If you are upgrading from an earlier release such as 5.13.3, first read
13L<perl5134delta>, which describes differences between 5.13.3 and
145.13.4.
15
4c793fe3
FR
16=head1 Core Enhancements
17
0c692eed
FR
18=head2 Adjacent pairs of nextstate opcodes are now optimized away
19
20Previously, in code such as
21
22 use constant DEBUG => 0;
23
24 sub GAK {
25 warn if DEBUG;
26 print "stuff\n";
27 }
28
29the ops for C<warn if DEBUG;> would be folded to a C<null> op (C<ex-const>), but
30the C<nextstate> op would remain, resulting in a runtime op dispatch of
31C<nextstate>, C<nextstate>, ...
32
7bc3efda
SH
33The execution of a sequence of C<nextstate> ops is indistinguishable from just
34the last C<nextstate> op so the peephole optimizer now eliminates the first of
35a pair of C<nextstate> ops, except where the first carries a label, since labels
36must not be eliminated by the optimizer and label usage isn't conclusively known
37at compile time.
4c793fe3 38
85318b69
FR
39=head2 API function to parse statements
40
41The C<parse_fullstmt> function has been added to allow parsing of a single
7bc3efda 42complete Perl statement. See L<perlapi> for details.
85318b69
FR
43
44=head2 API functions for accessing the runtime hinthash
45
7bc3efda
SH
46A new C API for introspecting the hinthash C<%^H> at runtime has been added.
47See C<cop_hints_2hv>, C<cop_hints_fetchpvn>, C<cop_hints_fetchpvs>,
78846812 48C<cop_hints_fetchsv>, and C<hv_copy_hints_hv> in L<perlapi> for details.
85318b69
FR
49
50=head2 C interface to C<caller()>
51
52The C<caller_cx> function has been added as an XSUB-writer's equivalent of
7bc3efda 53C<caller()>. See L<perlapi> for details.
4c793fe3
FR
54
55=head1 Incompatible Changes
56
7bc3efda 57=head2 Magic variables outside the main package
44428a46 58
7bc3efda
SH
59In previous versions of Perl, magic variables like C<$!>, C<%SIG>, etc. would
60'leak' into other packages. So C<%foo::SIG> could be used to access signals,
44428a46
FC
61C<${"foo::!"}> (with strict mode off) to access C's C<errno>, etc.
62
7bc3efda
SH
63This was a bug, or an 'unintentional' feature, which caused various ill effects,
64such as signal handlers being wiped when modules were loaded, etc.
44428a46 65
7bc3efda
SH
66This has been fixed (or the feature has been removed, depending on how you see
67it).
44428a46 68
85318b69
FR
69=head2 Smart-matching against array slices
70
71Previously, the following code resulted in a successful match:
72
73 my @a = qw(a y0 z);
74 my @b = qw(a x0 z);
75 $a[0 .. $#b] ~~ @b;
76
ebce6c40
FR
77This odd behaviour has now been fixed
78L<[perl #77468]|http://rt.perl.org/rt3//Public/Bug/Display.html?id=77468>.
85318b69 79
d6747b7a 80=head2 C API changes
4c793fe3 81
d6747b7a
NC
82The first argument of the C API function C<Perl_fetch_cop_label> has changed
83from C<struct refcounted he *> to C<COP *>, to better insulate the user from
84implementation details.
4c793fe3 85
d6747b7a 86This API function was marked as "may change", and likely isn't in use outside
7bc3efda 87the core. (Neither an unpacked CPAN, nor Google's codesearch, finds any other
d6747b7a 88references to it.)
4c793fe3
FR
89
90=head1 Deprecations
91
85318b69
FR
92=head2 Use of qw(...) as parentheses
93
94Historically the parser fooled itself into thinking that C<qw(...)> literals
95were always enclosed in parentheses, and as a result you could sometimes omit
96parentheses around them:
97
98 for $x qw(a b c) { ... }
99
100The parser no longer lies to itself in this way. Wrap the list literal in
101parentheses, like:
102
103 for $x (qw(a b c)) { ... }
4c793fe3
FR
104
105=head1 Performance Enhancements
106
4c793fe3
FR
107=over 4
108
109=item *
110
0c692eed
FR
111Scalars containing regular expressions now only allocate the part of the C<SV>
112body they actually use, saving some space.
4c793fe3 113
e2babdfb
FR
114=item *
115
116Compiling regular expressions has been made faster for the case where upgrading
7bc3efda 117the regex to utf8 is necessary but that isn't known when the compilation begins.
e2babdfb 118
4c793fe3
FR
119=back
120
121=head1 Modules and Pragmata
122
4c793fe3
FR
123=head2 Updated Modules and Pragmata
124
125=over 4
126
7bc3efda 127=item C<bigint>, C<bignum>, and C<bigrat>
4c793fe3 128
7bc3efda 129Upgraded from version 0.23 to 0.25.
8ebb9810 130
7bc3efda 131=item C<blib>
8ebb9810 132
7bc3efda 133Upgraded from version 1.05 to 1.06.
b3364d98 134
7bc3efda 135=item C<open>
b3364d98 136
7bc3efda 137Upgraded from version 1.07 to 1.08.
5355f933 138
7bc3efda
SH
139=item C<warnings>
140
141Upgraded from version 1.10 to 1.11.
5355f933 142
7bc3efda 143=item C<warnings::register>
4997ece7 144
7bc3efda 145Upgraded from version 1.01 to 1.02.
4997ece7
FR
146
147It is now possible to register warning categories other than the names of
ebce6c40 148packages using C<warnings::register>. See L<perllexwarn> for more information.
4997ece7 149
7bc3efda 150=item C<B::Debug>
4997ece7 151
7bc3efda 152Upgraded from version 1.12 to 1.16.
df91fef1 153
7bc3efda 154=item C<Data::Dumper>
df91fef1 155
7bc3efda 156Upgraded from version 2.126 to 2.128.
ccb45ef4
FR
157
158This fixes a crash when using custom sort functions that might cause the stack
159to change.
160
7bc3efda 161=item C<Encode>
ccb45ef4 162
7bc3efda 163Upgraded from version 2.39 to 2.40.
fb37c85c 164
7bc3efda 165=item C<Errno>
fb37c85c 166
7bc3efda 167Upgraded from version 1.12 to 1.13.
48c1efd2
FR
168
169On some platforms with unusual header files, like Win32/gcc using mingw64
170headers, some constants which weren't actually error numbers have been exposed
7bc3efda 171by C<Errno>. This has been fixed
ebce6c40 172L<[perl #77416]|http://rt.perl.org/rt3//Public/Bug/Display.html?id=77416>.
48c1efd2 173
7bc3efda 174=item C<ExtUtils::MakeMaker>
48c1efd2 175
7bc3efda 176Upgraded from version 6.56 to 6.57_05.
0c692eed 177
7bc3efda 178=item C<Filter::Simple>
0c692eed 179
7bc3efda 180Upgraded from version 0.84 to 0.85.
b3364d98 181
7bc3efda 182=item C<Hash::Util>
b3364d98 183
7bc3efda 184Upgraded from version 0.08 to 0.09.
78846812 185
7bc3efda 186=item C<Math::BigInt> and C<Math::BigInt::Calc>
78846812 187
7bc3efda
SH
188Upgraded from version 1.89_01 to 1.95 and from version 0.52 to 0.54
189respectively.
48c1efd2 190
a714e9cc 191This fixes, among other things, incorrect results when computing binomial
ebce6c40
FR
192coefficients
193L<[perl #77640]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=77640>.
48c1efd2 194
7bc3efda 195=item C<Math::BigInt::FastCalc>
48c1efd2 196
7bc3efda 197Upgraded from version 0.19 to 0.22.
b3364d98 198
7bc3efda 199=item C<Math::BigRat>
b3364d98 200
7bc3efda 201Upgraded from version 0.24 to 0.26.
07d14be5 202
7bc3efda 203=item C<Module::CoreList>
07d14be5 204
7bc3efda 205Upgraded from version 2.37 to 2.38.
85318b69 206
7bc3efda 207=item C<POSIX>
85318b69 208
7bc3efda 209Upgraded from version 1.19 to 1.20.
df91fef1
FR
210
211It now includes constants for POSIX signal constants.
212
7bc3efda 213=item C<Safe>
df91fef1 214
7bc3efda 215Upgraded from version 2.27 to 2.28.
e2babdfb
FR
216
217This fixes a possible infinite loop when looking for coderefs.
218
7bc3efda 219=item C<Tie::Hash>
e2babdfb 220
7bc3efda 221Upgraded from version 1.03 to 1.04.
c9a84c8b 222
7bc3efda 223Calling C<< Tie::Hash-E<gt>TIEHASH() >> used to loop forever. Now it C<croak>s.
c9a84c8b 224
7bc3efda 225=item C<Unicode::Collate>
c9a84c8b 226
7bc3efda 227Upgraded from version 0.56 to 0.59.
4c793fe3 228
7bc3efda 229=item C<XSLoader>
48c1efd2 230
7bc3efda 231Upgraded from version 0.10 to 0.11.
4c793fe3
FR
232
233=back
234
235=head1 Documentation
236
4c793fe3
FR
237=head2 Changes to Existing Documentation
238
0c692eed 239=head3 L<perlapi>
4c793fe3
FR
240
241=over 4
242
243=item *
244
0c692eed 245Many of the optree construction functions are now documented.
4c793fe3
FR
246
247=back
248
e2babdfb
FR
249=head3 L<perlfaq>
250
7bc3efda
SH
251=over 4
252
253=item *
254
e2babdfb 255L<perlfaq>, L<perlfaq2>, L<perlfaq4>, L<perlfaq5>, L<perlfaq6>, L<perlfaq8>, and
7bc3efda
SH
256L<perlfaq9> have seen various updates and modernizations.
257
258=back
e2babdfb 259
4c793fe3
FR
260=head1 Diagnostics
261
262The following additions or changes have been made to diagnostic output,
263including warnings and fatal error messages. For the complete list of
264diagnostic messages, see L<perldiag>.
265
4c793fe3
FR
266=head2 New Diagnostics
267
4c793fe3
FR
268=over 4
269
270=item *
271
85318b69 272Use of qw(...) as parentheses is deprecated
4c793fe3 273
ebce6c40
FR
274See L</"Use of qw(...) as parentheses"> for details.
275
4c793fe3
FR
276=back
277
4c793fe3
FR
278=head1 Utility Changes
279
48c1efd2 280=head3 L<h2ph>
4c793fe3
FR
281
282=over 4
283
284=item *
285
ebce6c40
FR
286The use of a deprecated C<goto> construct has been removed
287L<[perl #74404]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=74404>.
4c793fe3
FR
288
289=back
290
4c793fe3
FR
291=head1 Testing
292
4c793fe3
FR
293=over 4
294
295=item *
296
0c692eed
FR
297A rare race condition in F<t/op/while_readdir.t> has been fixed, stopping it
298from failing randomly when running tests in parallel.
4c793fe3 299
44428a46
FC
300=item *
301
302The new F<t/op/leaky-magic.t> script tests that magic applied to variables in
303the main packages does not affect other packages.
304
4c793fe3
FR
305=back
306
307=head1 Platform Support
308
4c793fe3
FR
309=head2 Platform-Specific Notes
310
4c793fe3
FR
311=over 4
312
0c692eed 313=item VMS
4c793fe3 314
0c692eed
FR
315=over 4
316
317=item *
318
7bc3efda 319Make C<PerlIOUnix_open> honour default permissions on VMS.
0c692eed 320
ebce6c40
FR
321When C<perlio> became the default and C<unixio> became the default bottom layer,
322the most common path for creating files from Perl became C<PerlIOUnix_open>,
323which has always explicitly used C<0666> as the permission mask.
0c692eed 324
7bc3efda
SH
325To avoid this, C<0777> is now passed as the permissions to C<open()>. In the
326VMS CRTL, C<0777> has a special meaning over and above intersecting with the
327current umask; specifically, it allows Unix syscalls to preserve native default
0c692eed
FR
328permissions.
329
330=back
4c793fe3
FR
331
332=back
333
334=head1 Internal Changes
335
4c793fe3
FR
336=over 4
337
338=item *
339
ebce6c40 340C<CALL_FPTR> and C<CPERLscope> have been deprecated.
0c692eed
FR
341
342Those are left from an old implementation of C<MULTIPLICITY> using C++ objects,
7bc3efda
SH
343which was removed in Perl 5.8. Nowadays these macros do exactly nothing, so
344they shouldn't be used anymore.
0c692eed 345
7bc3efda 346For compatibility, they are still defined for external C<XS> code. Only
0c692eed
FR
347extensions defining C<PERL_CORE> must be updated now.
348
349=item *
350
351C<lex_stuff_pvs()> has been added as a convenience macro wrapping
352C<lex_stuff_pvn()> for literal strings.
353
354=item *
355
7bc3efda 356The recursive part of the peephole optimizer is now hookable.
0c692eed
FR
357
358In addition to C<PL_peepp>, for hooking into the toplevel peephole optimizer, a
359C<PL_rpeepp> is now available to hook into the optimizer recursing into
360side-chains of the optree.
4c793fe3
FR
361
362=back
363
364=head1 Selected Bug Fixes
365
4c793fe3
FR
366=over 4
367
368=item *
369
7bc3efda 370A regression introduced in Perl 5.12.0, making
0c692eed 371C<< my $x = 3; $x = length(undef) >> result in C<$x> set to C<3> has been
7bc3efda 372fixed. C<$x> will now be C<undef>.
0c692eed
FR
373
374=item *
375
376A fatal error in regular expressions when processing UTF-8 data has been fixed
ebce6c40 377L<[perl #75680]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=75680>.
0c692eed
FR
378
379=item *
380
7bc3efda
SH
381An erroneous regular expression engine optimization that caused regex verbs like
382C<*COMMIT> to sometimes be ignored has been removed.
0c692eed
FR
383
384=item *
385
7bc3efda 386The Perl debugger now also works in taint mode
ebce6c40 387L<[perl #76872]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=76872>.
4c793fe3 388
8ebb9810
FR
389=item *
390
7bc3efda 391Several memory leaks in cloning and freeing threaded Perl interpreters have been
ebce6c40 392fixed L<[perl #77352]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=77352>.
8ebb9810 393
48c1efd2
FR
394=item *
395
396A possible string corruption when doing regular expression matches on overloaded
ebce6c40
FR
397objects has been fixed
398L<[perl #77084]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=77084>.
48c1efd2 399
44428a46
FC
400=item *
401
7bc3efda
SH
402Magic applied to variables in the main package no longer affects other packages.
403See L</Magic variables outside the main package> above
ebce6c40 404L<[perl #76138]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=76138>.
44428a46 405
f4beb78f
FC
406=item *
407
7bc3efda
SH
408Opening a glob reference via C<< open $fh, "E<gt>", \*glob >> will no longer
409cause the glob to be corrupted when the filehandle is printed to. This would
410cause perl to crash whenever the glob's contents were accessed
ebce6c40 411L<[perl #77492]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=77492>.
f4beb78f 412
ccb45ef4
FR
413=item *
414
7bc3efda
SH
415The postincrement and postdecrement operators, C<++> and C<-->, used to cause
416leaks when being used on references. This has now been fixed.
ccb45ef4 417
85318b69
FR
418=item *
419
ebce6c40 420A bug when replacing the glob of a loop variable within the loop has been fixed
7bc3efda 421L<[perl #21469]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=21469>. This
ebce6c40 422means the following code will no longer crash:
85318b69
FR
423
424 for $x (...) {
425 *x = *y;
426 }
427
80b6a949
AB
428=item *
429
7bc3efda
SH
430Perl would segfault if the undocumented C<Internals> functions that used
431reference prototypes were called with the C<&foo()> syntax, e.g.
432C<&Internals::SvREADONLY(undef)>
ebce6c40 433L<[perl #77776]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=77776>.
80b6a949 434
7bc3efda
SH
435These functions now call C<SvROK> on their arguments before dereferencing them
436with C<SvRV>, and we test for this case in F<t/lib/universal.t>.
80b6a949 437
e2babdfb
FR
438=item *
439
440When assigning a list with duplicated keys to a hash, the assignment used to
441return garbage and/or freed values:
442
7bc3efda 443 @a = %h = (list with some duplicate keys);
e2babdfb 444
7bc3efda
SH
445This has now been fixed
446L<[perl #31865]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=31865>.
e2babdfb
FR
447
448=item *
449
7bc3efda 450An earlier release of the 5.13 series of Perl changed the semantics of opening a
e2babdfb
FR
451reference to a copy of a glob:
452
453 my $var = *STDOUT;
454 open my $fh, '>', \$var;
455
7bc3efda 456This was a mistake, and the previous behaviour from Perl 5.10 and 5.12, which is
e2babdfb
FR
457to treat \$var as a scalar reference, has now been restored.
458
346e4e56
KW
459=item *
460
7bc3efda
SH
461The regular expression bracketed character class C<[\8\9]> was effectively the
462same as C<[89\000]>, incorrectly matching a NULL character. It also gave
463incorrect warnings that the C<8> and C<9> were ignored. Now C<[\8\9]> is the
464same as C<[89]> and gives legitimate warnings that C<\8> and C<\9> are
465unrecognized escape sequences, passed-through.
346e4e56 466
78846812
FR
467=item *
468
ebce6c40
FR
469C<warn()> now respects utf8-encoded scalars
470L<[perl #45549]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=45549>.
78846812 471
4c793fe3
FR
472=back
473
4c793fe3
FR
474=head1 Acknowledgements
475
476XXX The list of people to thank goes here.
477
478=head1 Reporting Bugs
479
480If you find what you think is a bug, you might check the articles
481recently posted to the comp.lang.perl.misc newsgroup and the perl
482bug database at http://rt.perl.org/perlbug/ . There may also be
483information at http://www.perl.org/ , the Perl Home Page.
484
485If you believe you have an unreported bug, please run the B<perlbug>
486program included with your release. Be sure to trim your bug down
487to a tiny but sufficient test case. Your bug report, along with the
488output of C<perl -V>, will be sent off to perlbug@perl.org to be
489analysed by the Perl porting team.
490
491If the bug you are reporting has security implications, which make it
492inappropriate to send to a publicly archived mailing list, then please send
7bc3efda 493it to perl5-security-report@perl.org. This points to a closed subscription
4c793fe3
FR
494unarchived mailing list, which includes all the core committers, who be able
495to help assess the impact of issues, figure out a resolution, and help
496co-ordinate the release of patches to mitigate or fix the problem across all
7bc3efda 497platforms on which Perl is supported. Please only use this address for
4c793fe3
FR
498security issues in the Perl core, not for modules independently
499distributed on CPAN.
500
501=head1 SEE ALSO
502
503The F<Changes> file for an explanation of how to view exhaustive details
504on what changed.
505
506The F<INSTALL> file for how to build Perl.
507
508The F<README> file for general stuff.
509
510The F<Artistic> and F<Copying> files for copyright information.
511
512=cut