5 perldelta - what is new for perl v5.19.1
9 This document describes differences between the 5.19.0 release and the 5.19.1
12 =head1 Core Enhancements
14 No new features have been added.
18 There are no new security issues.
20 =head1 Incompatible Changes
22 =head2 Most regex engine global state eliminated
24 As part of this series of fixes it was necessary to change the API of
25 Perl_re_intuit_start(). See L</Internal Changes> for more.
27 =head2 Locale decimal point character no longer leaks outside of S<C<use locale>> scope
29 This is actually a bug fix, but some code has come to rely on the bug
30 being present, so this change is listed here. The current locale that
31 the program is running under is not supposed to be visible to Perl code
32 except within the scope of a S<C<use locale>>. However, until now under
33 certain circumstances, the character used for a decimal point (often a
34 comma) leaked outside the scope. If your code is affected by this
35 change, simply add a S<C<use locale>>.
37 =head1 Performance Enhancements
43 Perl has a new copy-on-write mechanism that avoids the need to copy the
44 internal string buffer when assigning from one scalar to another. This
45 makes copying large strings appear much faster. Modifying one of the two
46 (or more) strings after an assignment will force a copy internally. This
47 makes it unnecessary to pass strings by reference for efficiency.
49 This feature was already available in 5.18.0, but wasn't enabled by
50 default. It is the default now, and so you no longer need build perl with
51 the F<Configure> argument:
53 -Accflags=PERL_NEW_COPY_ON_WRITE
55 It can be disabled (for now) in a perl build with:
61 =head1 Modules and Pragmata
63 XXX All changes to installed files in F<cpan/>, F<dist/>, F<ext/> and F<lib/>
64 go here. If Module::CoreList is updated, generate an initial draft of the
65 following sections using F<Porting/corelist-perldelta.pl>, which prints stub
66 entries to STDOUT. Results can be pasted in place of the '=head2' entries
67 below. A paragraph summary for important changes should then be added by hand.
68 In an ideal world, dual-life modules would have a F<Changes> file that could be
71 [ Within each section, list entries as a =item entry ]
73 =head2 New Modules and Pragmata
79 L<Module::CoreList::Utils> which provides information on which core and
80 dual-life utilities shipped with each version of L<perl>.
84 =head2 Updated Modules and Pragmata
90 L<B::Deparse> has been upgraded from version 1.20 to 1.21.
92 C<foreach my $lexical> is now deparsed correctly with the B<-p> option.
95 The B<-l> option no longer puts form feeds in the middle of a line when
96 outputting C<map> and C<grep> blocks. [RT #117311]
98 Elements of C<%#>, such as C<$# {foo}> and C<${#}{foo}> are now deparsed
99 correctly. [RT #117531]
103 L<DB> has been updated from 1.05 to 1.06 and L<perl5db.pl> from 1.39_10
104 to 1.40. The call depth allowed by default in the debugger is now 1000
109 L<File::Spec> has been upgraded from version 3.40 to 3.41.
111 C<tmpdir> now respects changes to environment variables from which the
112 temporary directory is derived. [RT #88940]
116 L<Test::Harness> has been upgraded from version 3.26 to 3.28
118 Memory usage is dramatically reduced. t/harness now uses about 10% of the
119 memory used by 3.26 and earlier.
121 C<PERL5LIB> is always propagated to a test's C<@INC>, even under C<-T>.
125 L<Unicode::UCD> has been upgraded from version 0.51 to 0.52.
127 A function, L<Unicode::UCD/search_invlist()> is now available to do
128 search an inversion list or map for a code point.
134 =head2 Changes to Existing Documentation
142 C<goto EXPR> is now documented to handle an expression that evalutes to a
143 code reference as if it was C<goto &$coderef>. This behavior is at least ten
148 C<eval EXPR> now has caveats about expanding floating point numbers in some
153 Noted that C<chop> and C<chomp> can reset the hash iterator
157 Improved fileno example
161 =head3 L<perlexperiment>
167 C<\s> matching C<\cK> is marked experimental
171 ithreads were accepted in 5.8.0
175 Long doubles are not experimental
185 Update to mention fc(), \F
195 There is now a L<JavaScript|perltrap/JavaScript Traps> section.
201 The following additions or changes have been made to diagnostic output,
202 including warnings and fatal error messages. For the complete list of
203 diagnostic messages, see L<perldiag>.
211 XXX L<message|perldiag/"message">
221 L<A sequence of multiple spaces in a charnames alias definition is deprecated|perldiag/"A sequence of multiple spaces in a charnames alias definition is deprecated">
223 L<Trailing white-space in a charnames alias definition is deprecated|perldiag/"Trailing white-space in a charnames alias definition is deprecated">
225 These two deprecation warnings involving C<\N{...}> were incorrectly
226 implemented. They did not warn by default (now they do) and could not be
227 made fatal via C<use warnings FATAL => 'deprecated'> (now they can).
231 =head1 Utility Changes
233 =head3 F<bisect.pl> enhancements
235 The git bisection tool F<Porting/bisect.pl> has had many enhancements.
241 Can optionally run the test case with a timeout.
245 Can now run in-place in a clean git checkout.
249 Can run the test case under C<valgrind>.
253 Can apply user supplied patches and fixes to the source checkout before
258 Now has fixups to enable building several more historical ranges of bleadperl,
259 which can be useful for pinpointing the origins of bugs or behaviour changes.
263 It is provided as part of the source distribution but not installed because
264 it is not self-contained as it relies on being run from within a git
265 checkout. Note also that it makes no attempt to fix tests, correct runtime
266 bugs or make something useful to install - its purpose is to make minimal
267 changes to get any historical revision of interest to build and run as close
268 as possible to "as-was", and thereby make C<git bisect> easy to use.
270 =head1 Platform Support
272 =head2 Discontinued Platforms
278 DG/UX was a Unix sold by Data General. The last release was in April 2001.
279 It only runs on Data General's own hardware.
283 =head2 Platform-Specific Notes
287 =item Mixed-endian platforms
289 The code supporting C<pack> and C<unpack> operations on mixed endian
290 platforms has been removed. We believe that Perl has long been unable to
291 build on mixed endian architectures (such as PDP-11s), so we don't think
292 that this change will affect any platforms which are able to build v5.18.0.
296 The BUILD_STATIC and ALL_STATIC makefile options for linking some or (nearly)
297 all extensions statically (into perl519.dll, and into a separate
298 perl-static.exe too) were broken for MinGW builds. This has now been fixed.
300 The ALL_STATIC option has also been improved to include the Encode and Win32
301 extensions (for both VC++ and MinGW builds).
305 =head1 Internal Changes
311 Perl's new copy-on-write mechanism (which is now enabled by default),
312 allows any C<SvPOK> scalar to be automatically upgraded to a copy-on-write
313 scalar when copied. A reference count on the string buffer is stored in
314 the string buffer itself.
318 $ perl -MDevel::Peek -e'$a="abc"; $b = $a; Dump $a; Dump $b'
319 SV = PV(0x260cd80) at 0x2620ad8
321 FLAGS = (POK,IsCOW,pPOK)
322 PV = 0x2619bc0 "abc"\0
326 SV = PV(0x260ce30) at 0x2620b20
328 FLAGS = (POK,IsCOW,pPOK)
329 PV = 0x2619bc0 "abc"\0
334 Note that both scalars share the same PV buffer and have a COW_REFCNT
337 This means that XS code which wishes to modify the C<SvPVX()> buffer of an
338 SV should call C<SvPV_force()> or similar first, to ensure a valid (and
339 unshared) buffer, and to call C<SvSETMAGIC()> afterwards. This in fact has
340 always been the case (for example hash keys were already copy-on-write);
341 this change just spreads the COW behaviour to a wider variety of SVs.
343 One important difference is that before 5.18.0, shared hash-key scalars
344 used to have the C<SvREADONLY> flag set; this is no longer the case.
346 This new behaviour can still be disabled by running F<Configure> with
347 B<-Accflags=-DPERL_NO_COW>. This option will probably be removed in Perl
352 C<PL_sawampersand> is now a constant. The switch this variable provided
353 (to enable/disable the pre-match copy depending on whether C<$&> had been
354 seen) has been removed and replaced with copy-on-write, eliminating a few
357 The previous behaviour can still be enabled by running F<Configure> with
358 B<-Accflags=-DPERL_SAWAMPERSAND>.
362 The functions C<my_swap>, C<my_htonl> and C<my_ntohl> have been removed.
363 It is unclear why these functions were ever marked as I<A>, part of the
364 API. XS code can't call them directly, as it can't rely on them being
365 compiled. Unsurprisingly, no code on CPAN references them.
369 The signature of the C<Perl_re_intuit_start()> regex function has changed;
370 the function pointer C<intuit> in the regex engine plugin structure
371 has also changed accordingly. A new parameter, C<strbeg> has been added;
372 this has the same meaning as the same-named parameter in
373 C<Perl_regexec_flags>. Previously intuit would try to guess the start of
374 the string from the passed SV (if any), and would sometimes get it wrong
375 (e.g. with an overloaded SV).
379 XS code may use various macros to change the case of a character or code
380 point (for example C<toLOWER_utf8()>). Only a couple of these were
381 documented until now;
382 and now they should be used in preference to calling the underlying
383 functions. See L<perlapi/Character case changing>.
387 The code dealt rather inconsistently with uids and gids. Some
388 places assumed that they could be safely stored in UVs, others
389 in IVs, others in ints. Four new macros are introduced:
390 SvUID(), sv_setuid(), SvGID(), and sv_setgid()
394 =head1 Selected Bug Fixes
400 The OP allocation code now returns correctly aligned memory in all cases
401 for C<struct pmop>. Previously it could return memory only aligned to a
402 4-byte boundary, which is not correct for an ithreads build with 64 bit IVs
403 on some 32 bit platforms. Notably, this caused the build to fail completely
404 on sparc GNU/Linux. [RT #118055]
408 The debugger's C<man> command been fixed. It was broken in the v5.18.0
409 release. The C<man> command is aliased to the names C<doc> and C<perldoc> -
414 C<@_> is now correctly visible in the debugger, fixing a regression
415 introduced in v5.18.0's debugger. [RT #118169]
419 Evaluating large hashes in scalar context is now much faster, as the number
420 of used chains in the hash is now cached for larger hashes. Smaller hashes
421 continue not to store it and calculate it when needed, as this saves one IV.
422 That would be 1 IV overhead for every object built from a hash. [RT #114576]
426 Fixed a small number of regexp constructions that could either fail to
427 match or crash perl when the string being matched against was
428 allocated above the 2GB line on 32-bit systems. [RT #118175]
432 Perl v5.16 inadvertently introduced a bug whereby calls to XSUBs that were
433 not visible at compile time were treated as lvalues and could be assigned
434 to, even when the subroutine was not an lvalue sub. This has been fixed.
439 In Perl v5.18.0 dualvars that had an empty string for the string part but a
440 non-zero number for the number part starting being treated as true. In
441 previous versions they were treated as false, the string representation
442 taking precedeence. The old behaviour has been restored. [RT #118159]
446 Since Perl v5.12, inlining of constants that override built-in keywords of
447 the same name had countermanded C<use subs>, causing subsequent mentions of
448 the constant to use the built-in keyword instead. This has been fixed.
452 Lexical constants (C<my sub a() { 42 }>) no longer crash when inlined.
456 Parameter prototypes attached to lexical subroutines are now respected when
457 compiling sub calls without parentheses. Previously, the prototypes were
458 honoured only for calls I<with> parentheses. [RT #116735]
462 Syntax errors in lexical subroutines in combination with calls to the same
463 subroutines no longer cause crashes at compile time.
467 The warning produced by C<-l $handle> now applies to IO refs and globs, not
468 just to glob refs. That warning is also now UTF8-clean. [RT #117595]
472 Various memory leaks involving the parsing of the C<(?[...])> regular
473 expression construct have been fixed.
477 C<(?[...])> now allows interpolation of precompiled patterns consisting of
478 C<(?[...])> with bracketed character classes inside (C<$pat =
479 S<qr/(?[ [a] ])/;> S</(?[ $pat ])/>>). Formerly, the brackets would
480 confuse the regular expression parser.
484 The "Quantifier unexpected on zero-length expression" warning message could
485 appear twice starting in Perl v5.10 for a regular expression also
486 containing alternations (e.g., "a|b") triggering the trie optimisation.
490 C<delete local $ENV{nonexistent_env_var}> no longer leaks memory.
494 C<sort> and C<require> followed by a keyword prefixed with C<CORE::> now
495 treat it as a keyword, and not as a subroutine or module name. [RT #24482]
499 Through certain conundrums, it is possible to cause the current package to
500 be freed. Certain operators (C<bless>, C<reset>, C<open>, C<eval>) could
501 not cope and would crash. They have been made more resilient. [RT #117941]
505 Aliasing filehandles through glob-to-glob assignment would not update
506 internal method caches properly if a package of the same name as the
507 filehandle existed, resulting in filehandle method calls going to the
508 package instead. This has been fixed.
512 C<./Configure -de -Dusevendorprefix> didn't default [RT #64126]
516 The C<Statement unlikely to be reached> warning was listed in
517 L<perldiag> as an C<exec>-category warning, but was enabled and disabled
518 by the C<syntax> category. On the other hand, the C<exec> category
519 controlled its fatal-ness. It is now entirely handled by the C<exec>
524 The "Replacement list is longer that search list" warning for C<tr///> and
525 C<y///> no longer occurs in the presence of the C</c> flag. [RT #118047]
529 Perl v5.18 inadvertently introduced a bug whereby interpolating mixed up-
530 and down-graded UTF-8 strings in a regex could result in malformed UTF-8
531 in the pattern: specifically if a downgraded character in the range
532 C<\x80..\xff> followed a UTF-8 string, e.g.
534 utf8::upgrade( my $u = "\x{e5}");
535 utf8::downgrade(my $d = "\x{e5}");
542 Stringification of NVs are not cached so that the lexical locale controls
543 stringification of the decimal point [perl #108378] [perl #115800]
547 =head1 Acknowledgements
549 XXX Generate this with:
551 perl Porting/acknowledgements.pl v5.19.1..HEAD
553 =head1 Reporting Bugs
555 If you find what you think is a bug, you might check the articles recently
556 posted to the comp.lang.perl.misc newsgroup and the perl bug database at
557 http://rt.perl.org/perlbug/ . There may also be information at
558 http://www.perl.org/ , the Perl Home Page.
560 If you believe you have an unreported bug, please run the L<perlbug> program
561 included with your release. Be sure to trim your bug down to a tiny but
562 sufficient test case. Your bug report, along with the output of C<perl -V>,
563 will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
565 If the bug you are reporting has security implications, which make it
566 inappropriate to send to a publicly archived mailing list, then please send it
567 to perl5-security-report@perl.org. This points to a closed subscription
568 unarchived mailing list, which includes all the core committers, who will be
569 able to help assess the impact of issues, figure out a resolution, and help
570 co-ordinate the release of patches to mitigate or fix the problem across all
571 platforms on which Perl is supported. Please only use this address for
572 security issues in the Perl core, not for modules independently distributed on
577 The F<Changes> file for an explanation of how to view exhaustive details on
580 The F<INSTALL> file for how to build Perl.
582 The F<README> file for general stuff.
584 The F<Artistic> and F<Copying> files for copyright information.