This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldiag: rewording
[perl5.git] / pod / perl5135delta.pod
CommitLineData
ee0887a9
SH
1=encoding utf8
2
3=head1 NAME
4
5perl5135delta - 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
16=head1 Core Enhancements
17
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
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.
38
39=head2 API function to parse statements
40
41The C<parse_fullstmt> function has been added to allow parsing of a single
42complete Perl statement. See L<perlapi> for details.
43
44=head2 API functions for accessing the runtime hinthash
45
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>,
48C<cop_hints_fetchsv>, and C<hv_copy_hints_hv> in L<perlapi> for details.
49
50=head2 C interface to C<caller()>
51
52The C<caller_cx> function has been added as an XSUB-writer's equivalent of
53C<caller()>. See L<perlapi> for details.
54
55=head1 Incompatible Changes
56
57=head2 Magic variables outside the main package
58
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,
61C<${"foo::!"}> (with strict mode off) to access C's C<errno>, etc.
62
63This was a bug, or an 'unintentional' feature, which caused various ill effects,
64such as signal handlers being wiped when modules were loaded, etc.
65
66This has been fixed (or the feature has been removed, depending on how you see
67it).
68
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);
405fd67e 75 @a[0 .. $#b] ~~ @b;
ee0887a9
SH
76
77This odd behaviour has now been fixed
78L<[perl #77468]|http://rt.perl.org/rt3//Public/Bug/Display.html?id=77468>.
79
80=head2 C API changes
81
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.
85
86This API function was marked as "may change", and likely isn't in use outside
87the core. (Neither an unpacked CPAN, nor Google's codesearch, finds any other
88references to it.)
89
90=head1 Deprecations
91
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)) { ... }
104
105=head1 Performance Enhancements
106
107=over 4
108
109=item *
110
111Scalars containing regular expressions now only allocate the part of the C<SV>
112body they actually use, saving some space.
113
114=item *
115
116Compiling regular expressions has been made faster for the case where upgrading
117the regex to utf8 is necessary but that isn't known when the compilation begins.
118
119=back
120
121=head1 Modules and Pragmata
122
123=head2 Updated Modules and Pragmata
124
125=over 4
126
127=item C<bignum>
128
129Upgraded from version 0.23 to 0.25.
130
131=item C<blib>
132
133Upgraded from version 1.05 to 1.06.
134
135=item C<open>
136
137Upgraded from version 1.07 to 1.08.
138
139=item C<threads-shared>
140
141Upgraded from version 1.33_02 to 1.33_03.
142
143=item C<warnings> and C<warnings::register>
144
145Upgraded from version 1.10 to 1.11 and from version 1.01 to 1.02 respectively.
146
147It is now possible to register warning categories other than the names of
148packages using C<warnings::register>. See L<perllexwarn> for more information.
149
150=item C<B::Debug>
151
152Upgraded from version 1.12 to 1.16.
153
154=item C<CPANPLUS::Dist::Build>
155
156Upgraded from version 0.46 to 0.48.
157
158=item C<Data::Dumper>
159
160Upgraded from version 2.126 to 2.128.
161
162This fixes a crash when using custom sort functions that might cause the stack
163to change.
164
165=item C<Encode>
166
167Upgraded from version 2.39 to 2.40.
168
169=item C<Errno>
170
171Upgraded from version 1.12 to 1.13.
172
173On some platforms with unusual header files, like Win32/gcc using mingw64
174headers, some constants which weren't actually error numbers have been exposed
175by C<Errno>. This has been fixed
176L<[perl #77416]|http://rt.perl.org/rt3//Public/Bug/Display.html?id=77416>.
177
178=item C<ExtUtils::MakeMaker>
179
180Upgraded from version 6.5601 to 6.57_05.
181
182=item C<Filter::Simple>
183
184Upgraded from version 0.84 to 0.85.
185
186=item C<Hash::Util>
187
188Upgraded from version 0.08 to 0.09.
189
190=item C<Math::BigInt>
191
192Upgraded from version 1.89_01 to 1.95.
193
194This fixes, among other things, incorrect results when computing binomial
195coefficients
196L<[perl #77640]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=77640>.
197
198=item C<Math::BigInt::FastCalc>
199
200Upgraded from version 0.19 to 0.22.
201
202=item C<Math::BigRat>
203
204Upgraded from version 0.24 to 0.26.
205
206=item C<Module::CoreList>
207
208Upgraded from version 2.37 to 2.38.
209
210=item C<PerlIO::scalar>
211
212Upgraded from version 0.08 to 0.09.
213
214=item C<POSIX>
215
216Upgraded from version 1.19 to 1.20.
217
218It now includes constants for POSIX signal constants.
219
220=item C<Safe>
221
222Upgraded from version 2.27 to 2.28.
223
224This fixes a possible infinite loop when looking for coderefs.
225
226=item C<Test::Simple>
227
228Upgraded from version 0.96 to 0.97_01.
229
230=item C<Tie::Hash>
231
232Upgraded from version 1.03 to 1.04.
233
234Calling C<< Tie::Hash-E<gt>TIEHASH() >> used to loop forever. Now it C<croak>s.
235
236=item C<Unicode::Collate>
237
238Upgraded from version 0.56 to 0.59.
239
240=item C<XSLoader>
241
242Upgraded from version 0.10 to 0.11.
243
244=back
245
246=head1 Documentation
247
248=head2 Changes to Existing Documentation
249
250=head3 L<perlapi>
251
252=over 4
253
254=item *
255
256Many of the optree construction functions are now documented.
257
258=back
259
260=head3 L<perlbook>
261
262=over 4
263
264=item *
265
266Expanded to cover many more popular books.
267
268=back
269
270=head3 L<perlfaq>
271
272=over 4
273
274=item *
275
276L<perlfaq>, L<perlfaq2>, L<perlfaq4>, L<perlfaq5>, L<perlfaq6>, L<perlfaq8>, and
277L<perlfaq9> have seen various updates and modernizations.
278
279=back
280
281=head1 Diagnostics
282
283The following additions or changes have been made to diagnostic output,
284including warnings and fatal error messages. For the complete list of
285diagnostic messages, see L<perldiag>.
286
287=head2 New Diagnostics
288
289=over 4
290
291=item *
292
293Parsing code internal error (%s)
294
295New fatal error produced when parsing code supplied by an extension violated the
296parser's API in a detectable way.
297
298=item *
299
300Use of qw(...) as parentheses is deprecated
301
302See L</"Use of qw(...) as parentheses"> for details.
303
304=back
305
cf174d21
FC
306=head2 Changes to Existing Diagnostics
307
308=over 4
309
310=item *
311
312C<warn> and C<die> now produce 'Wide character' warnings when fed a
313character outside the byte range if STDERR is a byte-sized handle.
314
315=back
316
ee0887a9
SH
317=head1 Utility Changes
318
319=head3 L<h2ph>
320
321=over 4
322
323=item *
324
325The use of a deprecated C<goto> construct has been removed
326L<[perl #74404]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=74404>.
327
328=back
329
330=head1 Testing
331
332=over 4
333
334=item *
335
336The new F<t/lib/universal.t> script tests the Internal::* functions and other
337things in F<universal.c>.
338
339=item *
340
341A rare race condition in F<t/op/while_readdir.t> has been fixed, stopping it
342from failing randomly when running tests in parallel.
343
344=item *
345
346The new F<t/op/leaky-magic.t> script tests that magic applied to variables in
347the main packages does not affect other packages.
348
349=back
350
351=head1 Platform Support
352
353=head2 Platform-Specific Notes
354
355=over 4
356
357=item VMS
358
359=over 4
360
361=item *
362
363Make C<PerlIOUnix_open> honour default permissions on VMS.
364
365When C<perlio> became the default and C<unixio> became the default bottom layer,
366the most common path for creating files from Perl became C<PerlIOUnix_open>,
367which has always explicitly used C<0666> as the permission mask.
368
369To avoid this, C<0777> is now passed as the permissions to C<open()>. In the
370VMS CRTL, C<0777> has a special meaning over and above intersecting with the
371current umask; specifically, it allows Unix syscalls to preserve native default
372permissions.
373
374=back
375
376=back
377
378=head1 Internal Changes
379
380=over 4
381
382=item *
383
384C<CALL_FPTR> and C<CPERLscope> have been deprecated.
385
386Those are left from an old implementation of C<MULTIPLICITY> using C++ objects,
387which was removed in Perl 5.8. Nowadays these macros do exactly nothing, so
388they shouldn't be used anymore.
389
390For compatibility, they are still defined for external C<XS> code. Only
391extensions defining C<PERL_CORE> must be updated now.
392
393=item *
394
395C<lex_stuff_pvs()> has been added as a convenience macro wrapping
396C<lex_stuff_pvn()> for literal strings.
397
398=item *
399
400The recursive part of the peephole optimizer is now hookable.
401
402In addition to C<PL_peepp>, for hooking into the toplevel peephole optimizer, a
403C<PL_rpeepp> is now available to hook into the optimizer recursing into
404side-chains of the optree.
405
406=back
407
408=head1 Selected Bug Fixes
409
410=over 4
411
412=item *
413
414A regression introduced in Perl 5.12.0, making
415C<< my $x = 3; $x = length(undef) >> result in C<$x> set to C<3> has been
416fixed. C<$x> will now be C<undef>.
417
418=item *
419
420A fatal error in regular expressions when processing UTF-8 data has been fixed
421L<[perl #75680]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=75680>.
422
423=item *
424
425An erroneous regular expression engine optimization that caused regex verbs like
426C<*COMMIT> to sometimes be ignored has been removed.
427
428=item *
429
430The Perl debugger now also works in taint mode
431L<[perl #76872]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=76872>.
432
433=item *
434
435Several memory leaks in cloning and freeing threaded Perl interpreters have been
436fixed L<[perl #77352]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=77352>.
437
438=item *
439
440A possible string corruption when doing regular expression matches on overloaded
441objects has been fixed
442L<[perl #77084]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=77084>.
443
444=item *
445
446Magic applied to variables in the main package no longer affects other packages.
447See L</Magic variables outside the main package> above
448L<[perl #76138]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=76138>.
449
450=item *
451
452Opening a glob reference via C<< open $fh, "E<gt>", \*glob >> will no longer
453cause the glob to be corrupted when the filehandle is printed to. This would
454cause perl to crash whenever the glob's contents were accessed
455L<[perl #77492]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=77492>.
456
457=item *
458
459The postincrement and postdecrement operators, C<++> and C<-->, used to cause
460leaks when being used on references. This has now been fixed.
461
462=item *
463
464A bug when replacing the glob of a loop variable within the loop has been fixed
465L<[perl #21469]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=21469>. This
466means the following code will no longer crash:
467
468 for $x (...) {
469 *x = *y;
470 }
471
472=item *
473
474Perl would segfault if the undocumented C<Internals> functions that used
475reference prototypes were called with the C<&foo()> syntax, e.g.
476C<&Internals::SvREADONLY(undef)>
477L<[perl #77776]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=77776>.
478
479These functions now call C<SvROK> on their arguments before dereferencing them
480with C<SvRV>, and we test for this case in F<t/lib/universal.t>.
481
482=item *
483
484When assigning a list with duplicated keys to a hash, the assignment used to
485return garbage and/or freed values:
486
487 @a = %h = (list with some duplicate keys);
488
489This has now been fixed
490L<[perl #31865]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=31865>.
491
492=item *
493
494An earlier release of the 5.13 series of Perl changed the semantics of opening a
495reference to a copy of a glob:
496
497 my $var = *STDOUT;
498 open my $fh, '>', \$var;
499
500This was a mistake, and the previous behaviour from Perl 5.10 and 5.12, which is
501to treat \$var as a scalar reference, has now been restored.
502
503=item *
504
505The regular expression bracketed character class C<[\8\9]> was effectively the
506same as C<[89\000]>, incorrectly matching a NULL character. It also gave
507incorrect warnings that the C<8> and C<9> were ignored. Now C<[\8\9]> is the
508same as C<[89]> and gives legitimate warnings that C<\8> and C<\9> are
509unrecognized escape sequences, passed-through.
510
511=item *
512
cf174d21 513C<warn()> and C<die()> now respect utf8-encoded scalars
ee0887a9
SH
514L<[perl #45549]|http://rt.perl.org/rt3/Public/Bug/Display.html?id=45549>.
515
516=back
517
518=head1 Known Problems
519
520=over 4
521
522=item *
523
524The upgrade to Encode-2.40 has caused some tests in the libwww-perl distribution
525on CPAN to fail. (Specifically, F<base/message-charset.t> tests 33-36 in version
5265.836 of that distribution now fail.)
527
528=item *
529
530The upgrade to ExtUtils-MakeMaker-6.57_05 has caused some tests in the
531Module-Install distribution on CPAN to fail. (Specifically, F<02_mymeta.t> tests
5325 and 21, F<18_all_from.t> tests 6 and 15, F<19_authors.t> tests 5, 13, 21 and
53329, and F<20_authors_with_special_characters.t> tests 6, 15 and 23 in version
5341.00 of that distribution now fail.)
535
536=back
537
538=head1 Acknowledgements
539
540Perl 5.13.5 represents approximately one month of development since
541Perl 5.13.4 and contains 74558 lines of changes across 549 files
542from 45 authors and committers:
543
544Abigail, Alexander Alekseev, Aristotle Pagaltzis, Ben Morrow, Bram, brian d foy,
545Chas. Owens, Chris 'BinGOs' Williams, Craig A. Berry, Curtis Jewell, Dagfinn
546Ilmari Mannsåker, David Golden, David Leadbeater, David Mitchell, Eric Brine,
547Father Chrysostomos, Florian Ragwitz, Gisle Aas, Jan Dubois, Jerry D. Hedden,
548Jesse Vincent, Jim Cromie, Jirka Hruška, Karl Williamson, Michael G. Schwern,
549Nicholas Clark, Paul Johnson, Philippe Bruhat (BooK), Piotr Fusik, Rafael
550Garcia-Suarez, Rainer Tammer, Reini Urban, Ricardo Signes, Rob Hoelz, Robin
551Barker, Steffen Mueller, Steve Hay, Steve Peters, Todd Rinaldo, Tony Cook,
552Vincent Pit, Yves Orton, Zefram, Zsbán Ambrus, Ævar Arnfjörð Bjarmason.
553
554Many of the changes included in this version originated in the CPAN
555modules included in Perl's core. We're grateful to the entire CPAN
556community for helping Perl to flourish.
557
558=head1 Reporting Bugs
559
560If you find what you think is a bug, you might check the articles
561recently posted to the comp.lang.perl.misc newsgroup and the perl
562bug database at http://rt.perl.org/perlbug/ . There may also be
563information at http://www.perl.org/ , the Perl Home Page.
564
565If you believe you have an unreported bug, please run the B<perlbug>
566program included with your release. Be sure to trim your bug down
567to a tiny but sufficient test case. Your bug report, along with the
568output of C<perl -V>, will be sent off to perlbug@perl.org to be
569analysed by the Perl porting team.
570
571If the bug you are reporting has security implications, which make it
572inappropriate to send to a publicly archived mailing list, then please send
573it to perl5-security-report@perl.org. This points to a closed subscription
574unarchived mailing list, which includes all the core committers, who be able
575to help assess the impact of issues, figure out a resolution, and help
576co-ordinate the release of patches to mitigate or fix the problem across all
577platforms on which Perl is supported. Please only use this address for
578security issues in the Perl core, not for modules independently
579distributed on CPAN.
580
581=head1 SEE ALSO
582
583The F<Changes> file for an explanation of how to view exhaustive details
584on what changed.
585
586The F<INSTALL> file for how to build Perl.
587
588The F<README> file for general stuff.
589
590The F<Artistic> and F<Copying> files for copyright information.
591
592=cut