This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op.c: Force shared hash key optimisation for existing COWs
[perl5.git] / pod / perl5191delta.pod
CommitLineData
38663f11
DG
1=encoding utf8
2
3=head1 NAME
4
5perl5191delta - what is new for perl v5.19.1
6
7=head1 DESCRIPTION
8
9This document describes differences between the 5.19.0 release and the 5.19.1
10release.
11
12=head1 Core Enhancements
13
14No new features have been added.
15
16=head1 Security
17
18There are no new security issues.
19
20=head1 Incompatible Changes
21
22=head2 Most regex engine global state eliminated
23
24As part of this series of fixes it was necessary to change the API of
25Perl_re_intuit_start(). See L</Internal Changes> for more.
26
27=head2 Locale decimal point character no longer leaks outside of S<C<use locale>> scope
28
29This is actually a bug fix, but some code has come to rely on the bug
30being present, so this change is listed here. The current locale that
31the program is running under is not supposed to be visible to Perl code
32except within the scope of a S<C<use locale>>. However, until now under
33certain circumstances, the character used for a decimal point (often a
34comma) leaked outside the scope. If your code is affected by this
35change, simply add a S<C<use locale>>.
36
37=head1 Performance Enhancements
38
39=over 4
40
41=item *
42
43Perl has a new copy-on-write mechanism that avoids the need to copy the
44internal string buffer when assigning from one scalar to another. This
45makes copying large strings appear much faster. Modifying one of the two
46(or more) strings after an assignment will force a copy internally. This
47makes it unnecessary to pass strings by reference for efficiency.
48
49This feature was already available in 5.18.0, but wasn't enabled by
50default. It is the default now, and so you no longer need build perl with
51the F<Configure> argument:
52
53 -Accflags=PERL_NEW_COPY_ON_WRITE
54
55It can be disabled (for now) in a perl build with:
56
57 -Accflags=PERL_NO_COW
58
59=back
60
61=head1 Modules and Pragmata
62
63=head2 Updated Modules and Pragmata
64
65=over 4
66
67=item *
68
69L<Archive::Tar> has been upgraded from version 1.90 to 1.92.
70
71=item *
72
73L<Attribute::Handlers> has been upgraded from version 0.94 to 0.95.
74
75=item *
76
77L<autodie> has been upgraded from version 2.13 to 2.19.
78
79=item *
80
81L<B> has been upgraded from version 1.42 to 1.43.
82
83=item *
84
85L<B::Concise> has been upgraded from version 0.95 to 0.96.
86
87=item *
88
89L<B::Deparse> has been upgraded from version 1.20 to 1.21.
90
91C<foreach my $lexical> is now deparsed correctly with the B<-p> option.
92[RT #117081]
93
94The B<-l> option no longer puts form feeds in the middle of a line when
95outputting C<map> and C<grep> blocks. [RT #117311]
96
97Elements of C<%#>, such as C<$# {foo}> and C<${#}{foo}> are now deparsed
98correctly. [RT #117531]
99
100=item *
101
102L<Benchmark> has been upgraded from version 1.15 to 1.16.
103
104=item *
105
106L<Carp> has been upgraded from version 1.29 to 1.30.
107
108=item *
109
110L<Compress::Raw::Bzip2> has been upgraded from version 2.060 to 2.061.
111
112=item *
113
114L<Compress::Raw::Zlib> has been upgraded from version 2.060 to 2.061.
115
116=item *
117
118L<Config::Perl::V> has been upgraded from version 0.17 to 0.18.
119
120=item *
121
122L<CPAN::Meta> has been upgraded from version 2.120921 to 2.131560.
123
124=item *
125
126L<Data::Dumper> has been upgraded from version 2.145 to 2.146.
127
128=item *
129
130L<DB> has been updated from 1.05 to 1.06 and L<perl5db.pl> from 1.39_10
131to 1.40.
132
133The call depth allowed by default in the debugger is now 1000
134rather than 100.
135
136=item *
137
138L<DB_File> has been upgraded from version 1.827 to 1.828.
139
140=item *
141
142L<Encode> has been upgraded from version 2.49 to 2.51.
143
144=item *
145
146L<ExtUtils::Install> has been upgraded from version 1.59 to 1.60.
147
148=item *
149
150L<ExtUtils::MakeMaker> has been upgraded from version 6.66 to 6.68.
151
152=item *
153
154L<ExtUtils::ParseXS> has been upgraded from version 3.18 to 3.19.
155
156=item *
157
158L<File::Copy> has been upgraded from version 2.26 to 2.27.
159
160=item *
161
162L<File::DosGlob> has been upgraded from version 1.10 to 1.11.
163
164=item *
165
166L<File::Fetch> has been upgraded from version 0.38 to 0.42.
167
168=item *
169
170L<File::Find> has been upgraded from version 1.23 to 1.24.
171
172=item *
173
174L<File::Spec> has been upgraded from version 3.40 to 3.41.
175
176C<tmpdir> now respects changes to environment variables from which the
177temporary directory is derived. [RT #88940]
178
179=item *
180
181L<File::Temp> has been upgraded from version 0.23 to 0.2301.
182
183=item *
184
185L<Filter::Simple> has been upgraded from version 0.89 to 0.90.
186
187=item *
188
189L<Filter::Util::Call> has been upgraded from version 1.45 to 1.49.
190
191=item *
192
193L<Getopt::Long> has been upgraded from version 2.39 to 2.4.
194
195=item *
196
197L<Hash::Util::FieldHash> has been upgraded from version 1.10 to 1.11.
198
199=item *
200
201L<HTTP::Tiny> has been upgraded from version 0.025 to 0.031.
202
203=item *
204
205L<IPC::Open3> has been upgraded from version 1.13 to 1.14.
206
207=item *
208
209L<Locale::Maketext> has been upgraded from version 1.23 to 1.24.
210
211=item *
212
213L<Math::BigInt> has been upgraded from version 1.9991 to 1.9992.
214
215=item *
216
217L<Math::BigRat> has been upgraded from version 0.2604 to 0.2606.
218
219=item *
220
221L<Module::Build> has been upgraded from version 0.4003 to 0.4005.
222
223=item *
224
225L<Module::CoreList> has been upgraded from version 2.91 to 2.92.
226
227Adds L<Module::CoreList::Utils> which provides information on which core and
228dual-life utilities shipped with each version of L<perl>.
229
230=item *
231
232L<Module::Metadata> has been upgraded from version 1.000011 to 1.000014.
233
234=item *
235
236L<mro> has been upgraded from version 1.11 to 1.12.
237
238=item *
239
240L<Net::Ping> has been upgraded from version 2.41 to 2.42.
241
242=item *
243
244L<perlfaq> has been upgraded from version 5.0150042 to 5.0150043.
245
246=item *
247
248L<Pod::Html> has been upgraded from version 1.18 to 1.19.
249
250=item *
251
252L<Pod::Parser> has been upgraded from version 1.60 to 1.61.
253
254=item *
255
256L<Pod::Perldoc> has been upgraded from version 3.19 to 3.20.
257
258=item *
259
260L<Pod::Usage> has been upgraded from version 1.61 to 1.63.
261
262=item *
263
264L<POSIX> has been upgraded from version 1.32 to 1.33.
265
266=item *
267
268L<re> has been upgraded from version 0.23 to 0.25.
269
270=item *
271
272L<Safe> has been upgraded from version 2.35 to 2.36.
273
274=item *
275
276L<Storable> has been upgraded from version 2.42 to 2.43.
277
278=item *
279
280L<Sys::Hostname> has been upgraded from version 1.17 to 1.18.
281
282=item *
283
284L<Sys::Syslog> has been upgraded from version 0.32 to 0.33.
285
286=item *
287
288L<Term::ReadLine> has been upgraded from version 1.12 to 1.13.
289
290=item *
291
292L<Test::Harness> has been upgraded from version 3.26 to 3.28
293
294Memory usage is dramatically reduced. t/harness now uses about 10% of the
295memory used by 3.26 and earlier.
296
297C<PERL5LIB> is always propagated to a test's C<@INC>, even under C<-T>.
298
299=item *
300
301L<threads> has been upgraded from version 1.86 to 1.87.
302
303=item *
304
305L<threads::shared> has been upgraded from version 1.43 to 1.44.
306
307=item *
308
309L<Tie::File> has been upgraded from version 0.99 to 1.00.
310
311=item *
312
313L<Time::Piece> has been upgraded from version 1.20_01 to 1.2002.
314
315=item *
316
317L<Unicode::Collate> has been upgraded from version 0.97 to 0.98.
318
319=item *
320
321L<Unicode::UCD> has been upgraded from version 0.51 to 0.52.
322
323A function, L<Unicode::UCD/search_invlist()> is now available to do
324search an inversion list or map for a code point.
325
326=back
327
328=head1 Documentation
329
330=head2 Changes to Existing Documentation
331
332=head3 L<perlfunc>
333
334=over
335
336=item *
337
338C<goto EXPR> is now documented to handle an expression that evalutes to a
339code reference as if it was C<goto &$coderef>. This behavior is at least ten
340years old.
341
342=item *
343
344C<eval EXPR> now has caveats about expanding floating point numbers in some
345locales
346
347=item *
348
349Noted that C<chop> and C<chomp> can reset the hash iterator
350
351=item *
352
353Improved C<fileno> example
354
355=back
356
357=head3 L<perlexperiment>
358
359=over
360
361=item *
362
363C<\s> matching C<\cK> is marked experimental
364
365=item *
366
367ithreads were accepted in 5.8.0
368
369=item *
370
371Long doubles are not experimental
372
373=back
374
375=head3 L<perllocale>
376
377=over
378
379=item *
380
381Update to mention fc(), \F
382
383=back
384
385=head3 L<perltrap>
386
387=over 4
388
389=item *
390
391There is now a L<JavaScript|perltrap/JavaScript Traps> section.
392
393=back
394
395=head1 Diagnostics
396
397The following additions or changes have been made to diagnostic output,
398including warnings and fatal error messages. For the complete list of
399diagnostic messages, see L<perldiag>.
400
401=head3 New Warnings
402
403=over 4
404
405=item *
406
407L<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">
408
409L<Trailing white-space in a charnames alias definition is deprecated|perldiag/"Trailing white-space in a charnames alias definition is deprecated">
410
411These two deprecation warnings involving C<\N{...}> were incorrectly
412implemented. They did not warn by default (now they do) and could not be
413made fatal via C<< use warnings FATAL => 'deprecated' >> (now they can).
414
415=back
416
417=head1 Utility Changes
418
419=head3 F<bisect.pl> enhancements
420
421The git bisection tool F<Porting/bisect.pl> has had many enhancements.
422
423=over 4
424
425=item *
426
427Can optionally run the test case with a timeout.
428
429=item *
430
431Can now run in-place in a clean git checkout.
432
433=item *
434
435Can run the test case under C<valgrind>.
436
437=item *
438
439Can apply user supplied patches and fixes to the source checkout before
440building.
441
442=item *
443
444Now has fixups to enable building several more historical ranges of bleadperl,
445which can be useful for pinpointing the origins of bugs or behaviour changes.
446
447=back
448
449It is provided as part of the source distribution but not installed because
450it is not self-contained as it relies on being run from within a git
451checkout. Note also that it makes no attempt to fix tests, correct runtime
452bugs or make something useful to install - its purpose is to make minimal
453changes to get any historical revision of interest to build and run as close
454as possible to "as-was", and thereby make C<git bisect> easy to use.
455
456=head1 Platform Support
457
458=head2 Discontinued Platforms
459
460=over 4
461
462=item DG/UX
463
464DG/UX was a Unix sold by Data General. The last release was in April 2001.
465It only runs on Data General's own hardware.
466
467=back
468
469=head2 Platform-Specific Notes
470
471=over 4
472
473=item Mixed-endian platforms
474
475The code supporting C<pack> and C<unpack> operations on mixed endian
476platforms has been removed. We believe that Perl has long been unable to
477build on mixed endian architectures (such as PDP-11s), so we don't think
478that this change will affect any platforms which are able to build v5.18.0.
479
480=item Windows
481
482The BUILD_STATIC and ALL_STATIC makefile options for linking some or (nearly)
483all extensions statically (into perl519.dll, and into a separate
484perl-static.exe too) were broken for MinGW builds. This has now been fixed.
485
486The ALL_STATIC option has also been improved to include the Encode and Win32
487extensions (for both VC++ and MinGW builds).
488
489=back
490
491=head1 Internal Changes
492
493=over 4
494
495=item *
496
497Perl's new copy-on-write mechanism (which is now enabled by default),
498allows any C<SvPOK> scalar to be automatically upgraded to a copy-on-write
499scalar when copied. A reference count on the string buffer is stored in
500the string buffer itself.
501
502For example:
503
504 $ perl -MDevel::Peek -e'$a="abc"; $b = $a; Dump $a; Dump $b'
505 SV = PV(0x260cd80) at 0x2620ad8
506 REFCNT = 1
507 FLAGS = (POK,IsCOW,pPOK)
508 PV = 0x2619bc0 "abc"\0
509 CUR = 3
510 LEN = 16
511 COW_REFCNT = 1
512 SV = PV(0x260ce30) at 0x2620b20
513 REFCNT = 1
514 FLAGS = (POK,IsCOW,pPOK)
515 PV = 0x2619bc0 "abc"\0
516 CUR = 3
517 LEN = 16
518 COW_REFCNT = 1
519
520Note that both scalars share the same PV buffer and have a COW_REFCNT
521greater than zero.
522
523This means that XS code which wishes to modify the C<SvPVX()> buffer of an
524SV should call C<SvPV_force()> or similar first, to ensure a valid (and
525unshared) buffer, and to call C<SvSETMAGIC()> afterwards. This in fact has
526always been the case (for example hash keys were already copy-on-write);
527this change just spreads the COW behaviour to a wider variety of SVs.
528
529One important difference is that before 5.18.0, shared hash-key scalars
530used to have the C<SvREADONLY> flag set; this is no longer the case.
531
532This new behaviour can still be disabled by running F<Configure> with
533B<-Accflags=-DPERL_NO_COW>. This option will probably be removed in Perl
5345.22.
535
536=item *
537
538C<PL_sawampersand> is now a constant. The switch this variable provided
539(to enable/disable the pre-match copy depending on whether C<$&> had been
540seen) has been removed and replaced with copy-on-write, eliminating a few
541bugs.
542
543The previous behaviour can still be enabled by running F<Configure> with
544B<-Accflags=-DPERL_SAWAMPERSAND>.
545
546=item *
547
548The functions C<my_swap>, C<my_htonl> and C<my_ntohl> have been removed.
549It is unclear why these functions were ever marked as I<A>, part of the
550API. XS code can't call them directly, as it can't rely on them being
551compiled. Unsurprisingly, no code on CPAN references them.
552
553=item *
554
555The signature of the C<Perl_re_intuit_start()> regex function has changed;
556the function pointer C<intuit> in the regex engine plugin structure
557has also changed accordingly. A new parameter, C<strbeg> has been added;
558this has the same meaning as the same-named parameter in
559C<Perl_regexec_flags>. Previously intuit would try to guess the start of
560the string from the passed SV (if any), and would sometimes get it wrong
561(e.g. with an overloaded SV).
562
563=item *
564
565XS code may use various macros to change the case of a character or code
566point (for example C<toLOWER_utf8()>). Only a couple of these were
567documented until now;
568and now they should be used in preference to calling the underlying
569functions. See L<perlapi/Character case changing>.
570
571=item *
572
573The code dealt rather inconsistently with uids and gids. Some
574places assumed that they could be safely stored in UVs, others
575in IVs, others in ints. Four new macros are introduced:
576SvUID(), sv_setuid(), SvGID(), and sv_setgid()
577
578=back
579
580=head1 Selected Bug Fixes
581
582=over 4
583
584=item *
585
586The OP allocation code now returns correctly aligned memory in all cases
587for C<struct pmop>. Previously it could return memory only aligned to a
5884-byte boundary, which is not correct for an ithreads build with 64 bit IVs
589on some 32 bit platforms. Notably, this caused the build to fail completely
590on sparc GNU/Linux. [RT #118055]
591
592=item *
593
594The debugger's C<man> command been fixed. It was broken in the v5.18.0
595release. The C<man> command is aliased to the names C<doc> and C<perldoc> -
596all now work again.
597
598=item *
599
600C<@_> is now correctly visible in the debugger, fixing a regression
601introduced in v5.18.0's debugger. [RT #118169]
602
603=item *
604
605Evaluating large hashes in scalar context is now much faster, as the number
606of used chains in the hash is now cached for larger hashes. Smaller hashes
607continue not to store it and calculate it when needed, as this saves one IV.
608That would be 1 IV overhead for every object built from a hash. [RT #114576]
609
610=item *
611
612Fixed a small number of regexp constructions that could either fail to
613match or crash perl when the string being matched against was
614allocated above the 2GB line on 32-bit systems. [RT #118175]
615
616=item *
617
618Perl v5.16 inadvertently introduced a bug whereby calls to XSUBs that were
619not visible at compile time were treated as lvalues and could be assigned
620to, even when the subroutine was not an lvalue sub. This has been fixed.
621[RT #117947]
622
623=item *
624
625In Perl v5.18.0 dualvars that had an empty string for the string part but a
626non-zero number for the number part starting being treated as true. In
627previous versions they were treated as false, the string representation
628taking precedeence. The old behaviour has been restored. [RT #118159]
629
630=item *
631
632Since Perl v5.12, inlining of constants that override built-in keywords of
633the same name had countermanded C<use subs>, causing subsequent mentions of
634the constant to use the built-in keyword instead. This has been fixed.
635
636=item *
637
638Lexical constants (C<my sub a() { 42 }>) no longer crash when inlined.
639
640=item *
641
642Parameter prototypes attached to lexical subroutines are now respected when
643compiling sub calls without parentheses. Previously, the prototypes were
644honoured only for calls I<with> parentheses. [RT #116735]
645
646=item *
647
648Syntax errors in lexical subroutines in combination with calls to the same
649subroutines no longer cause crashes at compile time.
650
651=item *
652
8088f39e
FC
653Deep recursion warnings no longer crash lexical subroutines. [RT #118521]
654
655=item *
656
38663f11
DG
657The warning produced by C<-l $handle> now applies to IO refs and globs, not
658just to glob refs. That warning is also now UTF8-clean. [RT #117595]
659
660=item *
661
662Various memory leaks involving the parsing of the C<(?[...])> regular
663expression construct have been fixed.
664
665=item *
666
667C<(?[...])> now allows interpolation of precompiled patterns consisting of
668C<(?[...])> with bracketed character classes inside (C<$pat =
669S<qr/(?[ [a] ])/;> S</(?[ $pat ])/>>). Formerly, the brackets would
670confuse the regular expression parser.
671
672=item *
673
674The "Quantifier unexpected on zero-length expression" warning message could
675appear twice starting in Perl v5.10 for a regular expression also
676containing alternations (e.g., "a|b") triggering the trie optimisation.
677
678=item *
679
680C<delete local $ENV{nonexistent_env_var}> no longer leaks memory.
681
682=item *
683
684C<sort> and C<require> followed by a keyword prefixed with C<CORE::> now
685treat it as a keyword, and not as a subroutine or module name. [RT #24482]
686
687=item *
688
689Through certain conundrums, it is possible to cause the current package to
690be freed. Certain operators (C<bless>, C<reset>, C<open>, C<eval>) could
691not cope and would crash. They have been made more resilient. [RT #117941]
692
693=item *
694
695Aliasing filehandles through glob-to-glob assignment would not update
696internal method caches properly if a package of the same name as the
697filehandle existed, resulting in filehandle method calls going to the
698package instead. This has been fixed.
699
700=item *
701
702C<./Configure -de -Dusevendorprefix> didn't default [RT #64126]
703
704=item *
705
706The C<Statement unlikely to be reached> warning was listed in
707L<perldiag> as an C<exec>-category warning, but was enabled and disabled
708by the C<syntax> category. On the other hand, the C<exec> category
709controlled its fatal-ness. It is now entirely handled by the C<exec>
710category.
711
712=item *
713
714The "Replacement list is longer that search list" warning for C<tr///> and
715C<y///> no longer occurs in the presence of the C</c> flag. [RT #118047]
716
717=item *
718
719Perl v5.18 inadvertently introduced a bug whereby interpolating mixed up-
720and down-graded UTF-8 strings in a regex could result in malformed UTF-8
721in the pattern: specifically if a downgraded character in the range
722C<\x80..\xff> followed a UTF-8 string, e.g.
723
724 utf8::upgrade( my $u = "\x{e5}");
725 utf8::downgrade(my $d = "\x{e5}");
726 /$u$d/
727
728[RT #118297]
729
730=item *
731
732Stringification of NVs are not cached so that the lexical locale controls
733stringification of the decimal point [perl #108378] [perl #115800]
734
735=back
736
737=head1 Acknowledgements
738
739Perl 5.19.1 represents approximately 4 weeks of development since Perl 5.19.0
740and contains approximately 26,000 lines of changes across 680 files from 37
741authors.
742
743Perl continues to flourish into its third decade thanks to a vibrant community
744of users and developers. The following people are known to have contributed the
745improvements that became Perl 5.19.1:
746
747Alexandr Ciornii, Brian Fraser, Chris 'BinGOs' Williams, Craig A. Berry,
748Dagfinn Ilmari Mannsåker, Daniel Dragan, David Golden, David Mitchell, David
749Steinbrunner, Dominic Hargreaves, Eric Brine, Father Chrysostomos, H.Merijn
750Brand, Heiko Eissfeldt, James E Keenan, Jerry D. Hedden, Kang-min Liu, Karl
751Williamson, Leon Timmermans, Lukas Mai, Marcel Grünauer, Mark Jason Dominus,
752Max Maischein, Mike Doherty, Nicholas Clark, Paul Green, Peter Martini, Petr
753Písař, Ricardo Signes, Shirakata Kentaro, Shlomi Fish, Steffen Müller, Steve
754Hay, Sullivan Beck, Tony Cook, Yves Orton, Zsbán Ambrus.
755
756The list above is almost certainly incomplete as it is automatically generated
757from version control history. In particular, it does not include the names of
758the (very much appreciated) contributors who reported issues to the Perl bug
759tracker.
760
761Many of the changes included in this version originated in the CPAN modules
762included in Perl's core. We're grateful to the entire CPAN community for
763helping Perl to flourish.
764
765For a more complete list of all of Perl's historical contributors, please see
766the F<AUTHORS> file in the Perl source distribution.
767
768=head1 Reporting Bugs
769
770If you find what you think is a bug, you might check the articles recently
771posted to the comp.lang.perl.misc newsgroup and the perl bug database at
772http://rt.perl.org/perlbug/ . There may also be information at
773http://www.perl.org/ , the Perl Home Page.
774
775If you believe you have an unreported bug, please run the L<perlbug> program
776included with your release. Be sure to trim your bug down to a tiny but
777sufficient test case. Your bug report, along with the output of C<perl -V>,
778will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
779
780If the bug you are reporting has security implications, which make it
781inappropriate to send to a publicly archived mailing list, then please send it
782to perl5-security-report@perl.org. This points to a closed subscription
783unarchived mailing list, which includes all the core committers, who will be
784able to help assess the impact of issues, figure out a resolution, and help
785co-ordinate the release of patches to mitigate or fix the problem across all
786platforms on which Perl is supported. Please only use this address for
787security issues in the Perl core, not for modules independently distributed on
788CPAN.
789
790=head1 SEE ALSO
791
792The F<Changes> file for an explanation of how to view exhaustive details on
793what changed.
794
795The F<INSTALL> file for how to build Perl.
796
797The F<README> file for general stuff.
798
799The F<Artistic> and F<Copying> files for copyright information.
800
801=cut