-
Notifications
You must be signed in to change notification settings - Fork 2
/
perl5140delta.html
3343 lines (2095 loc) · 200 KB
/
perl5140delta.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>perl5140delta - what is new for perl v5.14.0</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:[email protected]" />
</head>
<body>
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#Notice">Notice</a></li>
<li><a href="#Core-Enhancements">Core Enhancements</a>
<ul>
<li><a href="#Unicode">Unicode</a>
<ul>
<li><a href="#Unicode-Version-6.0-is-now-supported-mostly">Unicode Version 6.0 is now supported (mostly)</a></li>
<li><a href="#Full-functionality-for-use-feature-unicode_strings">Full functionality for use feature 'unicode_strings'</a></li>
<li><a href="#N-NAME-and-charnames-enhancements">\N{NAME} and charnames enhancements</a></li>
<li><a href="#New-warnings-categories-for-problematic-non--Unicode-code-points">New warnings categories for problematic (non-)Unicode code points.</a></li>
<li><a href="#Any-unsigned-value-can-be-encoded-as-a-character">Any unsigned value can be encoded as a character</a></li>
<li><a href="#Unicode-database-files-not-installed">Unicode database files not installed</a></li>
</ul>
</li>
<li><a href="#Regular-Expressions">Regular Expressions</a>
<ul>
<li><a href="#construct-signifies-default-modifiers">(?^...) construct signifies default modifiers</a></li>
<li><a href="#d-l-u-and-a-modifiers">/d, /l, /u, and /a modifiers</a></li>
<li><a href="#Non-destructive-substitution">Non-destructive substitution</a></li>
<li><a href="#Re-entrant-regular-expression-engine">Re-entrant regular expression engine</a></li>
<li><a href="#use-re-flags">use re '/flags'</a></li>
<li><a href="#o-...-for-octals">\o{...} for octals</a></li>
<li><a href="#Add-p-Titlecase-as-a-synonym-for-p-Title">Add \p{Titlecase} as a synonym for \p{Title}</a></li>
<li><a href="#Regular-expression-debugging-output-improvement">Regular expression debugging output improvement</a></li>
<li><a href="#Return-value-of-delete">Return value of delete $+{...}</a></li>
</ul>
</li>
<li><a href="#Syntactical-Enhancements">Syntactical Enhancements</a>
<ul>
<li><a href="#Array-and-hash-container-functions-accept-references">Array and hash container functions accept references</a></li>
<li><a href="#Single-term-prototype">Single term prototype</a></li>
<li><a href="#package-block-syntax">package block syntax</a></li>
<li><a href="#Statement-labels-can-appear-in-more-places">Statement labels can appear in more places</a></li>
<li><a href="#Stacked-labels">Stacked labels</a></li>
<li><a href="#Uppercase-X-B-allowed-in-hexadecimal-binary-literals">Uppercase X/B allowed in hexadecimal/binary literals</a></li>
<li><a href="#Overridable-tie-functions">Overridable tie functions</a></li>
</ul>
</li>
<li><a href="#Exception-Handling">Exception Handling</a></li>
<li><a href="#Other-Enhancements">Other Enhancements</a>
<ul>
<li><a href="#Assignment-to-0-sets-the-legacy-process-name-with-prctl-on-Linux">Assignment to $0 sets the legacy process name with prctl() on Linux</a></li>
<li><a href="#srand-now-returns-the-seed">srand() now returns the seed</a></li>
<li><a href="#printf-like-functions-understand-post-1980-size-modifiers">printf-like functions understand post-1980 size modifiers</a></li>
<li><a href="#New-global-variable-GLOBAL_PHASE">New global variable ${^GLOBAL_PHASE}</a></li>
<li><a href="#d:-foo-calls-Devel::foo::unimport">-d:-foo calls Devel::foo::unimport</a></li>
<li><a href="#Filehandle-method-calls-load-IO::File-on-demand">Filehandle method calls load IO::File on demand</a></li>
<li><a href="#Improved-IPv6-support">Improved IPv6 support</a></li>
<li><a href="#DTrace-probes-now-include-package-name">DTrace probes now include package name</a></li>
</ul>
</li>
<li><a href="#New-C-APIs">New C APIs</a></li>
</ul>
</li>
<li><a href="#Security">Security</a>
<ul>
<li><a href="#User-defined-regular-expression-properties">User-defined regular expression properties</a></li>
</ul>
</li>
<li><a href="#Incompatible-Changes">Incompatible Changes</a>
<ul>
<li><a href="#Regular-Expressions-and-String-Escapes">Regular Expressions and String Escapes</a>
<ul>
<li><a href="#Inverted-bracketed-character-classes-and-multi-character-folds">Inverted bracketed character classes and multi-character folds</a></li>
<li><a href="#pod-400--777">\400-\777</a></li>
<li><a href="#Most-p-properties-are-now-immune-to-case-insensitive-matching">Most \p{} properties are now immune to case-insensitive matching</a></li>
<li><a href="#p-implies-Unicode-semantics">\p{} implies Unicode semantics</a></li>
<li><a href="#Regular-expressions-retain-their-localeness-when-interpolated">Regular expressions retain their localeness when interpolated</a></li>
<li><a href="#Stringification-of-regexes-has-changed">Stringification of regexes has changed</a></li>
<li><a href="#Run-time-code-blocks-in-regular-expressions-inherit-pragmata">Run-time code blocks in regular expressions inherit pragmata</a></li>
</ul>
</li>
<li><a href="#Stashes-and-Package-Variables">Stashes and Package Variables</a>
<ul>
<li><a href="#Localised-tied-hashes-and-arrays-are-no-longed-tied">Localised tied hashes and arrays are no longed tied</a></li>
<li><a href="#Stashes-are-now-always-defined">Stashes are now always defined</a></li>
<li><a href="#Clearing-stashes">Clearing stashes</a></li>
<li><a href="#Dereferencing-typeglobs">Dereferencing typeglobs</a></li>
<li><a href="#Magic-variables-outside-the-main-package">Magic variables outside the main package</a></li>
<li><a href="#local-_-strips-all-magic-from-_">local($_) strips all magic from $_</a></li>
<li><a href="#Parsing-of-package-and-variable-names">Parsing of package and variable names</a></li>
</ul>
</li>
<li><a href="#Changes-to-Syntax-or-to-Perl-Operators">Changes to Syntax or to Perl Operators</a>
<ul>
<li><a href="#given-return-values">given return values</a></li>
<li><a href="#Change-in-parsing-of-certain-prototypes">Change in parsing of certain prototypes</a></li>
<li><a href="#Smart-matching-against-array-slices">Smart-matching against array slices</a></li>
<li><a href="#Negation-treats-strings-differently-from-before">Negation treats strings differently from before</a></li>
<li><a href="#Negative-zero">Negative zero</a></li>
<li><a href="#is-now-a-syntax-error">:= is now a syntax error</a></li>
<li><a href="#Change-in-the-parsing-of-identifiers">Change in the parsing of identifiers</a></li>
</ul>
</li>
<li><a href="#Threads-and-Processes">Threads and Processes</a>
<ul>
<li><a href="#Directory-handles-not-copied-to-threads">Directory handles not copied to threads</a></li>
<li><a href="#close-on-shared-pipes">close on shared pipes</a></li>
<li><a href="#fork-emulation-will-not-wait-for-signalled-children">fork() emulation will not wait for signalled children</a></li>
</ul>
</li>
<li><a href="#Configuration">Configuration</a>
<ul>
<li><a href="#Naming-fixes-in-Policy_sh.SH-may-invalidate-Policy.sh">Naming fixes in Policy_sh.SH may invalidate Policy.sh</a></li>
<li><a href="#Perl-source-code-is-read-in-text-mode-on-Windows">Perl source code is read in text mode on Windows</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#Deprecations">Deprecations</a>
<ul>
<li><a href="#Omitting-a-space-between-a-regular-expression-and-subsequent-word">Omitting a space between a regular expression and subsequent word</a></li>
<li><a href="#cX">\cX</a></li>
<li><a href="#b-and-B">"\b{" and "\B{"</a></li>
<li><a href="#Perl-4-era-.pl-libraries">Perl 4-era .pl libraries</a></li>
<li><a href="#List-assignment-to">List assignment to $[</a></li>
<li><a href="#Use-of-qw-...-as-parentheses">Use of qw(...) as parentheses</a></li>
<li><a href="#N-BELL">\N{BELL}</a></li>
<li><a href="#PATTERN">?PATTERN?</a></li>
<li><a href="#Tie-functions-on-scalars-holding-typeglobs">Tie functions on scalars holding typeglobs</a></li>
<li><a href="#User-defined-case-mapping">User-defined case-mapping</a></li>
<li><a href="#Deprecated-modules">Deprecated modules</a></li>
</ul>
</li>
<li><a href="#Performance-Enhancements">Performance Enhancements</a>
<ul>
<li><a href="#Safe-signals-optimisation">"Safe signals" optimisation</a></li>
<li><a href="#Optimisation-of-shift-and-pop-calls-without-arguments">Optimisation of shift() and pop() calls without arguments</a></li>
<li><a href="#Optimisation-of-regexp-engine-string-comparison-work">Optimisation of regexp engine string comparison work</a></li>
<li><a href="#Regular-expression-compilation-speed-up">Regular expression compilation speed-up</a></li>
<li><a href="#String-appending-is-100-times-faster">String appending is 100 times faster</a></li>
<li><a href="#Eliminate-PL_-accessor-functions-under-ithreads">Eliminate PL_* accessor functions under ithreads</a></li>
<li><a href="#Freeing-weak-references">Freeing weak references</a></li>
<li><a href="#Lexical-array-and-hash-assignments">Lexical array and hash assignments</a></li>
<li><a href="#uses-less-memory">@_ uses less memory</a></li>
<li><a href="#Size-optimisations-to-SV-and-HV-structures">Size optimisations to SV and HV structures</a></li>
<li><a href="#Memory-consumption-improvements-to-Exporter">Memory consumption improvements to Exporter</a></li>
<li><a href="#Memory-savings-for-weak-references">Memory savings for weak references</a></li>
<li><a href="#and---use-less-memory">%+ and %- use less memory</a></li>
<li><a href="#Multiple-small-improvements-to-threads">Multiple small improvements to threads</a></li>
<li><a href="#Adjacent-pairs-of-nextstate-opcodes-are-now-optimized-away">Adjacent pairs of nextstate opcodes are now optimized away</a></li>
</ul>
</li>
<li><a href="#Modules-and-Pragmata">Modules and Pragmata</a>
<ul>
<li><a href="#New-Modules-and-Pragmata">New Modules and Pragmata</a></li>
<li><a href="#Updated-Modules-and-Pragma">Updated Modules and Pragma</a></li>
<li><a href="#Removed-Modules-and-Pragmata">Removed Modules and Pragmata</a></li>
</ul>
</li>
<li><a href="#Documentation">Documentation</a>
<ul>
<li><a href="#New-Documentation">New Documentation</a>
<ul>
<li><a href="#perlgpl">perlgpl</a></li>
<li><a href="#Perl-5.12.x-delta-files">Perl 5.12.x delta files</a></li>
<li><a href="#perlpodstyle">perlpodstyle</a></li>
<li><a href="#perlsource-perlinterp-perlhacktut-and-perlhacktips">perlsource, perlinterp, perlhacktut, and perlhacktips</a></li>
</ul>
</li>
<li><a href="#Changes-to-Existing-Documentation">Changes to Existing Documentation</a>
<ul>
<li><a href="#perlmodlib-is-now-complete">perlmodlib is now complete</a></li>
<li><a href="#Replace-incorrect-tr-table-in-perlebcdic">Replace incorrect tr/// table in perlebcdic</a></li>
<li><a href="#Tricks-for-user-defined-casing">Tricks for user-defined casing</a></li>
<li><a href="#INSTALL-explicitly-states-that-Perl-requires-a-C89-compiler">INSTALL explicitly states that Perl requires a C89 compiler</a></li>
<li><a href="#Explanation-of-xHH-and-oOOO-escapes">Explanation of \xHH and \oOOO escapes</a></li>
<li><a href="#NNN-switch">-0NNN switch</a></li>
<li><a href="#Maintenance-policy">Maintenance policy</a></li>
<li><a href="#Deprecation-policy">Deprecation policy</a></li>
<li><a href="#New-descriptions-in-perldiag">New descriptions in perldiag</a></li>
<li><a href="#perlbook">perlbook</a></li>
<li><a href="#SvTRUE-macro">SvTRUE macro</a></li>
<li><a href="#op-manipulation-functions">op manipulation functions</a></li>
<li><a href="#perlvar-revamp">perlvar revamp</a></li>
<li><a href="#Array-and-hash-slices-in-scalar-context">Array and hash slices in scalar context</a></li>
<li><a href="#use-locale-and-formats">use locale and formats</a></li>
<li><a href="#overload">overload</a></li>
<li><a href="#perlhack-and-perlrepository-revamp">perlhack and perlrepository revamp</a></li>
<li><a href="#Time::Piece-examples">Time::Piece examples</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#Diagnostics">Diagnostics</a>
<ul>
<li><a href="#New-Diagnostics">New Diagnostics</a>
<ul>
<li><a href="#New-Errors">New Errors</a></li>
<li><a href="#New-Warnings">New Warnings</a></li>
</ul>
</li>
<li><a href="#Changes-to-Existing-Diagnostics">Changes to Existing Diagnostics</a></li>
</ul>
</li>
<li><a href="#Utility-Changes">Utility Changes</a>
<ul>
<li>
<ul>
<li><a href="#perlbug-1">perlbug(1)</a></li>
<li><a href="#perl5db.pl">perl5db.pl</a></li>
<li><a href="#ptargrep">ptargrep</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#Configuration-and-Compilation">Configuration and Compilation</a></li>
<li><a href="#Platform-Support">Platform Support</a>
<ul>
<li><a href="#New-Platforms">New Platforms</a></li>
<li><a href="#Discontinued-Platforms">Discontinued Platforms</a></li>
<li><a href="#Platform-Specific-Notes">Platform-Specific Notes</a>
<ul>
<li><a href="#AIX1">AIX</a></li>
<li><a href="#ARM">ARM</a></li>
<li><a href="#Cygwin">Cygwin</a></li>
<li><a href="#FreeBSD-7">FreeBSD 7</a></li>
<li><a href="#HP-UX">HP-UX</a></li>
<li><a href="#IRIX">IRIX</a></li>
<li><a href="#Mac-OS-X">Mac OS X</a></li>
<li><a href="#MirBSD">MirBSD</a></li>
<li><a href="#NetBSD">NetBSD</a></li>
<li><a href="#OpenBSD">OpenBSD</a></li>
<li><a href="#OpenVOS">OpenVOS</a></li>
<li><a href="#Solaris">Solaris</a></li>
<li><a href="#VMS">VMS</a></li>
<li><a href="#Windows">Windows</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#Internal-Changes">Internal Changes</a>
<ul>
<li><a href="#New-APIs">New APIs</a>
<ul>
<li><a href="#CLONE_PARAMS-structure-added-to-ease-correct-thread-creation">CLONE_PARAMS structure added to ease correct thread creation</a></li>
<li><a href="#New-parsing-functions">New parsing functions</a></li>
<li><a href="#Hints-hash-API">Hints hash API</a></li>
<li><a href="#C-interface-to-caller">C interface to caller()</a></li>
<li><a href="#Custom-per-subroutine-check-hooks">Custom per-subroutine check hooks</a></li>
<li><a href="#Improved-support-for-custom-OPs">Improved support for custom OPs</a></li>
<li><a href="#Scope-hooks">Scope hooks</a></li>
<li><a href="#The-recursive-part-of-the-peephole-optimizer-is-now-hookable">The recursive part of the peephole optimizer is now hookable</a></li>
<li><a href="#New-non-magical-variants-of-existing-functions">New non-magical variants of existing functions</a></li>
<li><a href="#pv-pvs-sv-versions-of-existing-functions">pv/pvs/sv versions of existing functions</a></li>
<li><a href="#List-op-building-functions">List op-building functions</a></li>
<li><a href="#LINKLIST">LINKLIST</a></li>
<li><a href="#Localisation-functions">Localisation functions</a></li>
<li><a href="#Stash-names">Stash names</a></li>
<li><a href="#New-functions-for-finding-and-removing-magic">New functions for finding and removing magic</a></li>
<li><a href="#find_rundefsv">find_rundefsv</a></li>
<li><a href="#Perl_croak_no_modify">Perl_croak_no_modify</a></li>
<li><a href="#PERL_STATIC_INLINE-define">PERL_STATIC_INLINE define</a></li>
<li><a href="#New-pv_escape-option-for-hexadecimal-escapes">New pv_escape option for hexadecimal escapes</a></li>
<li><a href="#lex_start">lex_start</a></li>
<li><a href="#op_scope-and-op_lvalue">op_scope() and op_lvalue()</a></li>
</ul>
</li>
<li><a href="#C-API-Changes">C API Changes</a>
<ul>
<li><a href="#PERL_POLLUTE-has-been-removed">PERL_POLLUTE has been removed</a></li>
<li><a href="#Check-API-compatibility-when-loading-XS-modules">Check API compatibility when loading XS modules</a></li>
<li><a href="#Perl_fetch_cop_label">Perl_fetch_cop_label</a></li>
<li><a href="#GvCV-and-GvGP-are-no-longer-lvalues">GvCV() and GvGP() are no longer lvalues</a></li>
<li><a href="#CvGV-is-no-longer-an-lvalue">CvGV() is no longer an lvalue</a></li>
<li><a href="#CvSTASH-is-no-longer-an-lvalue">CvSTASH() is no longer an lvalue</a></li>
<li><a href="#Calling-conventions-for-newFOROP-and-newWHILEOP">Calling conventions for newFOROP and newWHILEOP</a></li>
<li><a href="#Flags-passed-to-uvuni_to_utf8_flags-and-utf8n_to_uvuni">Flags passed to uvuni_to_utf8_flags and utf8n_to_uvuni</a></li>
</ul>
</li>
<li><a href="#Deprecated-C-APIs">Deprecated C APIs</a></li>
<li><a href="#Other-Internal-Changes">Other Internal Changes</a>
<ul>
<li><a href="#Stack-unwinding">Stack unwinding</a></li>
<li><a href="#Scope-stack-entries">Scope stack entries</a></li>
<li><a href="#Memory-allocation-for-pointer-tables">Memory allocation for pointer tables</a></li>
<li><a href="#UNDERBAR">UNDERBAR</a></li>
<li><a href="#String-comparison-routines-renamed">String comparison routines renamed</a></li>
<li><a href="#chop-and-chomp-implementations-merged">chop and chomp implementations merged</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#Selected-Bug-Fixes">Selected Bug Fixes</a>
<ul>
<li><a href="#I-O">I/O</a></li>
<li><a href="#Regular-Expression-Bug-Fixes">Regular Expression Bug Fixes</a></li>
<li><a href="#Syntax-Parsing-Bugs">Syntax/Parsing Bugs</a></li>
<li><a href="#Stashes-Globs-and-Method-Lookup">Stashes, Globs and Method Lookup</a></li>
<li><a href="#Unicode1">Unicode</a></li>
<li><a href="#Ties-Overloading-and-Other-Magic">Ties, Overloading and Other Magic</a></li>
<li><a href="#The-Debugger">The Debugger</a></li>
<li><a href="#Threads">Threads</a></li>
<li><a href="#Scoping-and-Subroutines">Scoping and Subroutines</a></li>
<li><a href="#Signals">Signals</a></li>
<li><a href="#Miscellaneous-Memory-Leaks">Miscellaneous Memory Leaks</a></li>
<li><a href="#Memory-Corruption-and-Crashes">Memory Corruption and Crashes</a></li>
<li><a href="#Fixes-to-Various-Perl-Operators">Fixes to Various Perl Operators</a></li>
<li><a href="#Bugs-Relating-to-the-C-API">Bugs Relating to the C API</a></li>
</ul>
</li>
<li><a href="#Known-Problems">Known Problems</a></li>
<li><a href="#Errata">Errata</a>
<ul>
<li><a href="#keys-values-and-each-work-on-arrays">keys(), values(), and each() work on arrays</a></li>
<li><a href="#split-and-_">split() and @_</a></li>
</ul>
</li>
<li><a href="#Obituary">Obituary</a></li>
<li><a href="#Acknowledgements">Acknowledgements</a></li>
<li><a href="#Reporting-Bugs">Reporting Bugs</a></li>
<li><a href="#SEE-ALSO">SEE ALSO</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>perl5140delta - what is new for perl v5.14.0</p>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>This document describes differences between the 5.12.0 release and the 5.14.0 release.</p>
<p>If you are upgrading from an earlier release such as 5.10.0, first read <a href="/cperl/perl5120delta.html">perl5120delta</a>, which describes differences between 5.10.0 and 5.12.0.</p>
<p>Some of the bug fixes in this release have been backported to subsequent releases of 5.12.x. Those are indicated with the 5.12.x version in parentheses.</p>
<h1 id="Notice">Notice</h1>
<p>As described in <a href="/cperl/perlpolicy.html">perlpolicy</a>, the release of Perl 5.14.0 marks the official end of support for Perl 5.10. Users of Perl 5.10 or earlier should consider upgrading to a more recent release of Perl.</p>
<h1 id="Core-Enhancements">Core Enhancements</h1>
<h2 id="Unicode">Unicode</h2>
<h3 id="Unicode-Version-6.0-is-now-supported-mostly">Unicode Version 6.0 is now supported (mostly)</h3>
<p>Perl comes with the Unicode 6.0 data base updated with <a href="http://www.unicode.org/versions/corrigendum8.html">Corrigendum #8</a>, with one exception noted below. See <a href="http://unicode.org/versions/Unicode6.0.0/">http://unicode.org/versions/Unicode6.0.0/</a> for details on the new release. Perl does not support any Unicode provisional properties, including the new ones for this release.</p>
<p>Unicode 6.0 has chosen to use the name <code>BELL</code> for the character at U+1F514, which is a symbol that looks like a bell, and is used in Japanese cell phones. This conflicts with the long-standing Perl usage of having <code>BELL</code> mean the ASCII <code>BEL</code> character, U+0007. In Perl 5.14, <code>\N{BELL}</code> continues to mean U+0007, but its use generates a deprecation warning message unless such warnings are turned off. The new name for U+0007 in Perl is <code>ALERT</code>, which corresponds nicely with the existing shorthand sequence for it, <code>"\a"</code>. <code>\N{BEL}</code> means U+0007, with no warning given. The character at U+1F514 has no name in 5.14, but can be referred to by <code>\N{U+1F514}</code>. In Perl 5.16, <code>\N{BELL}</code> will refer to U+1F514; all code that uses <code>\N{BELL}</code> should be converted to use <code>\N{ALERT}</code>, <code>\N{BEL}</code>, or <code>"\a"</code> before upgrading.</p>
<h3 id="Full-functionality-for-use-feature-unicode_strings">Full functionality for <code>use feature 'unicode_strings'</code></h3>
<p>This release provides full functionality for <code>use feature 'unicode_strings'</code>. Under its scope, all string operations executed and regular expressions compiled (even if executed outside its scope) have Unicode semantics. See <a href="/cperl/lib/feature.html#the-unicode_strings-feature">"the 'unicode_strings' feature" in feature</a>. However, see <a href="#Inverted-bracketed-character-classes-and-multi-character-folds">"Inverted bracketed character classes and multi-character folds"</a>, below.</p>
<p>This feature avoids most forms of the "Unicode Bug" (see <a href="/cperl/perlunicode.html#The-Unicode-Bug">"The "Unicode Bug"" in perlunicode</a> for details). If there is any possibility that your code will process Unicode strings, you are <i>strongly</i> encouraged to use this subpragma to avoid nasty surprises.</p>
<h3 id="N-NAME-and-charnames-enhancements"><code>\N{<i>NAME</i>}</code> and <code>charnames</code> enhancements</h3>
<ul>
<li><p><code>\N{<i>NAME</i>}</code> and <code>charnames::vianame</code> now know about the abbreviated character names listed by Unicode, such as NBSP, SHY, LRO, ZWJ, etc.; all customary abbreviations for the C0 and C1 control characters (such as ACK, BEL, CAN, etc.); and a few new variants of some C1 full names that are in common usage.</p>
</li>
<li><p>Unicode has several <i>named character sequences</i>, in which particular sequences of code points are given names. <code>\N{<i>NAME</i>}</code> now recognizes these.</p>
</li>
<li><p><code>\N{<i>NAME</i>}</code>, <code>charnames::vianame</code>, and <code>charnames::viacode</code> now know about every character in Unicode. In earlier releases of Perl, they didn't know about the Hangul syllables nor several CJK (Chinese/Japanese/Korean) characters.</p>
</li>
<li><p>It is now possible to override Perl's abbreviations with your own custom aliases.</p>
</li>
<li><p>You can now create a custom alias of the ordinal of a character, known by <code>\N{<i>NAME</i>}</code>, <code>charnames::vianame()</code>, and <code>charnames::viacode()</code>. Previously, aliases had to be to official Unicode character names. This made it impossible to create an alias for unnamed code points, such as those reserved for private use.</p>
</li>
<li><p>The new function charnames::string_vianame() is a run-time version of <code>\N{<i>NAME</i>}}</code>, returning the string of characters whose Unicode name is its parameter. It can handle Unicode named character sequences, whereas the pre-existing charnames::vianame() cannot, as the latter returns a single code point.</p>
</li>
</ul>
<p>See <a href="/cperl/lib/charnames.html">charnames</a> for details on all these changes.</p>
<h3 id="New-warnings-categories-for-problematic-non--Unicode-code-points">New warnings categories for problematic (non-)Unicode code points.</h3>
<p>Three new warnings subcategories of "utf8" have been added. These allow you to turn off some "utf8" warnings, while allowing other warnings to remain on. The three categories are: <code>surrogate</code> when UTF-16 surrogates are encountered; <code>nonchar</code> when Unicode non-character code points are encountered; and <code>non_unicode</code> when code points above the legal Unicode maximum of 0x10FFFF are encountered.</p>
<h3 id="Any-unsigned-value-can-be-encoded-as-a-character">Any unsigned value can be encoded as a character</h3>
<p>With this release, Perl is adopting a model that any unsigned value can be treated as a code point and encoded internally (as utf8) without warnings, not just the code points that are legal in Unicode. However, unless utf8 or the corresponding sub-category (see previous item) of lexical warnings have been explicitly turned off, outputting or executing a Unicode-defined operation such as upper-casing on such a code point generates a warning. Attempting to input these using strict rules (such as with the <code>:encoding(UTF-8)</code> layer) will continue to fail. Prior to this release, handling was inconsistent and in places, incorrect.</p>
<p>Unicode non-characters, some of which previously were erroneously considered illegal in places by Perl, contrary to the Unicode Standard, are now always legal internally. Inputting or outputting them works the same as with the non-legal Unicode code points, because the Unicode Standard says they are (only) illegal for "open interchange".</p>
<h3 id="Unicode-database-files-not-installed">Unicode database files not installed</h3>
<p>The Unicode database files are no longer installed with Perl. This doesn't affect any functionality in Perl and saves significant disk space. If you need these files, you can download them from <a href="http://www.unicode.org/Public/zipped/6.0.0/">http://www.unicode.org/Public/zipped/6.0.0/</a>.</p>
<h2 id="Regular-Expressions">Regular Expressions</h2>
<h3 id="construct-signifies-default-modifiers"><code>(?^...)</code> construct signifies default modifiers</h3>
<p>An ASCII caret <code>"^"</code> immediately following a <code>"(?"</code> in a regular expression now means that the subexpression does not inherit surrounding modifiers such as <code>/i</code>, but reverts to the Perl defaults. Any modifiers following the caret override the defaults.</p>
<p>Stringification of regular expressions now uses this notation. For example, <code>qr/hlagh/i</code> would previously be stringified as <code>(?i-xsm:hlagh)</code>, but now it's stringified as <code>(?^i:hlagh)</code>.</p>
<p>The main purpose of this change is to allow tests that rely on the stringification <i>not</i> to have to change whenever new modifiers are added. See <a href="/cperl/perlre.html#Extended-Patterns">"Extended Patterns" in perlre</a>.</p>
<p>This change is likely to break code that compares stringified regular expressions with fixed strings containing <code>?-xism</code>.</p>
<h3 id="d-l-u-and-a-modifiers"><code>/d</code>, <code>/l</code>, <code>/u</code>, and <code>/a</code> modifiers</h3>
<p>Four new regular expression modifiers have been added. These are mutually exclusive: one only can be turned on at a time.</p>
<ul>
<li><p>The <code>/l</code> modifier says to compile the regular expression as if it were in the scope of <code>use locale</code>, even if it is not.</p>
</li>
<li><p>The <code>/u</code> modifier says to compile the regular expression as if it were in the scope of a <code>use feature 'unicode_strings'</code> pragma.</p>
</li>
<li><p>The <code>/d</code> (default) modifier is used to override any <code>use locale</code> and <code>use feature 'unicode_strings'</code> pragmas in effect at the time of compiling the regular expression.</p>
</li>
<li><p>The <code>/a</code> regular expression modifier restricts <code>\s</code>, <code>\d</code> and <code>\w</code> and the POSIX (<code>[[:posix:]]</code>) character classes to the ASCII range. Their complements and <code>\b</code> and <code>\B</code> are correspondingly affected. Otherwise, <code>/a</code> behaves like the <code>/u</code> modifier, in that case-insensitive matching uses Unicode semantics.</p>
<p>If the <code>/a</code> modifier is repeated, then additionally in case-insensitive matching, no ASCII character can match a non-ASCII character. For example,</p>
<pre><code> "k" =~ /\N{KELVIN SIGN}/ai
"\xDF" =~ /ss/ai</code></pre>
<p>match but</p>
<pre><code> "k" =~ /\N{KELVIN SIGN}/aai
"\xDF" =~ /ss/aai</code></pre>
<p>do not match.</p>
</li>
</ul>
<p>See <a href="/cperl/perlre.html#Modifiers">"Modifiers" in perlre</a> for more detail.</p>
<h3 id="Non-destructive-substitution">Non-destructive substitution</h3>
<p>The substitution (<code>s///</code>) and transliteration (<code>y///</code>) operators now support an <code>/r</code> option that copies the input variable, carries out the substitution on the copy, and returns the result. The original remains unmodified.</p>
<pre><code> my $old = "cat";
my $new = $old =~ s/cat/dog/r;
# $old is "cat" and $new is "dog"</code></pre>
<p>This is particularly useful with <code>map</code>. See <a href="/cperl/perlop.html">perlop</a> for more examples.</p>
<h3 id="Re-entrant-regular-expression-engine">Re-entrant regular expression engine</h3>
<p>It is now safe to use regular expressions within <code>(?{...})</code> and <code>(??{...})</code> code blocks inside regular expressions.</p>
<p>These blocks are still experimental, however, and still have problems with lexical (<code>my</code>) variables and abnormal exiting.</p>
<h3 id="use-re-flags"><code>use re '/flags'</code></h3>
<p>The <code>re</code> pragma now has the ability to turn on regular expression flags till the end of the lexical scope:</p>
<pre><code> use re "/x";
"foo" =~ / (.+) /; # /x implied</code></pre>
<p>See <a href="/cperl/lib/re.html#flags-mode">"'/flags' mode" in re</a> for details.</p>
<h3 id="o-...-for-octals">\o{...} for octals</h3>
<p>There is a new octal escape sequence, <code>"\o"</code>, in doublequote-like contexts. This construct allows large octal ordinals beyond the current max of 0777 to be represented. It also allows you to specify a character in octal which can safely be concatenated with other regex snippets and which won't be confused with being a backreference to a regex capture group. See <a href="/cperl/perlre.html#Capture-groups">"Capture groups" in perlre</a>.</p>
<h3 id="Add-p-Titlecase-as-a-synonym-for-p-Title">Add <code>\p{Titlecase}</code> as a synonym for <code>\p{Title}</code></h3>
<p>This synonym is added for symmetry with the Unicode property names <code>\p{Uppercase}</code> and <code>\p{Lowercase}</code>.</p>
<h3 id="Regular-expression-debugging-output-improvement">Regular expression debugging output improvement</h3>
<p>Regular expression debugging output (turned on by <code>use re 'debug'</code>) now uses hexadecimal when escaping non-ASCII characters, instead of octal.</p>
<h3 id="Return-value-of-delete">Return value of <code>delete $+{...}</code></h3>
<p>Custom regular expression engines can now determine the return value of <code>delete</code> on an entry of <code>%+</code> or <code>%-</code>.</p>
<h2 id="Syntactical-Enhancements">Syntactical Enhancements</h2>
<h3 id="Array-and-hash-container-functions-accept-references">Array and hash container functions accept references</h3>
<p><b>Warning:</b> This feature is considered experimental, as the exact behaviour may change in a future version of Perl.</p>
<p>All builtin functions that operate directly on array or hash containers now also accept unblessed hard references to arrays or hashes:</p>
<pre><code> |----------------------------+---------------------------|
| Traditional syntax | Terse syntax |
|----------------------------+---------------------------|
| push @$arrayref, @stuff | push $arrayref, @stuff |
| unshift @$arrayref, @stuff | unshift $arrayref, @stuff |
| pop @$arrayref | pop $arrayref |
| shift @$arrayref | shift $arrayref |
| splice @$arrayref, 0, 2 | splice $arrayref, 0, 2 |
| keys %$hashref | keys $hashref |
| keys @$arrayref | keys $arrayref |
| values %$hashref | values $hashref |
| values @$arrayref | values $arrayref |
| ($k,$v) = each %$hashref | ($k,$v) = each $hashref |
| ($k,$v) = each @$arrayref | ($k,$v) = each $arrayref |
|----------------------------+---------------------------|</code></pre>
<p>This allows these builtin functions to act on long dereferencing chains or on the return value of subroutines without needing to wrap them in <code>@{}</code> or <code>%{}</code>:</p>
<pre><code> push @{$obj->tags}, $new_tag; # old way
push $obj->tags, $new_tag; # new way
for ( keys %{$hoh->{genres}{artists}} ) {...} # old way
for ( keys $hoh->{genres}{artists} ) {...} # new way </code></pre>
<h3 id="Single-term-prototype">Single term prototype</h3>
<p>The <code>+</code> prototype is a special alternative to <code>$</code> that acts like <code>\[@%]</code> when given a literal array or hash variable, but will otherwise force scalar context on the argument. See <a href="/cperl/perlsub.html#Prototypes">"Prototypes" in perlsub</a>.</p>
<h3 id="package-block-syntax"><code>package</code> block syntax</h3>
<p>A package declaration can now contain a code block, in which case the declaration is in scope inside that block only. So <code>package Foo { ... }</code> is precisely equivalent to <code>{ package Foo; ... }</code>. It also works with a version number in the declaration, as in <code>package Foo 1.2 { ... }</code>, which is its most attractive feature. See <a href="/cperl/perlfunc.html">perlfunc</a>.</p>
<h3 id="Statement-labels-can-appear-in-more-places">Statement labels can appear in more places</h3>
<p>Statement labels can now occur before any type of statement or declaration, such as <code>package</code>.</p>
<h3 id="Stacked-labels">Stacked labels</h3>
<p>Multiple statement labels can now appear before a single statement.</p>
<h3 id="Uppercase-X-B-allowed-in-hexadecimal-binary-literals">Uppercase X/B allowed in hexadecimal/binary literals</h3>
<p>Literals may now use either upper case <code>0X...</code> or <code>0B...</code> prefixes, in addition to the already supported <code>0x...</code> and <code>0b...</code> syntax [perl #76296].</p>
<p>C, Ruby, Python, and PHP already support this syntax, and it makes Perl more internally consistent: a round-trip with <code>eval sprintf "%#X", 0x10</code> now returns <code>16</code>, just like <code>eval sprintf "%#x", 0x10</code>.</p>
<h3 id="Overridable-tie-functions">Overridable tie functions</h3>
<p><code>tie</code>, <code>tied</code> and <code>untie</code> can now be overridden [perl #75902].</p>
<h2 id="Exception-Handling">Exception Handling</h2>
<p>To make them more reliable and consistent, several changes have been made to how <code>die</code>, <code>warn</code>, and <code>$@</code> behave.</p>
<ul>
<li><p>When an exception is thrown inside an <code>eval</code>, the exception is no longer at risk of being clobbered by destructor code running during unwinding. Previously, the exception was written into <code>$@</code> early in the throwing process, and would be overwritten if <code>eval</code> was used internally in the destructor for an object that had to be freed while exiting from the outer <code>eval</code>. Now the exception is written into <code>$@</code> last thing before exiting the outer <code>eval</code>, so the code running immediately thereafter can rely on the value in <code>$@</code> correctly corresponding to that <code>eval</code>. (<code>$@</code> is still also set before exiting the <code>eval</code>, for the sake of destructors that rely on this.)</p>
<p>Likewise, a <code>local $@</code> inside an <code>eval</code> no longer clobbers any exception thrown in its scope. Previously, the restoration of <code>$@</code> upon unwinding would overwrite any exception being thrown. Now the exception gets to the <code>eval</code> anyway. So <code>local $@</code> is safe before a <code>die</code>.</p>
<p>Exceptions thrown from object destructors no longer modify the <code>$@</code> of the surrounding context. (If the surrounding context was exception unwinding, this used to be another way to clobber the exception being thrown.) Previously such an exception was sometimes emitted as a warning, and then either was string-appended to the surrounding <code>$@</code> or completely replaced the surrounding <code>$@</code>, depending on whether that exception and the surrounding <code>$@</code> were strings or objects. Now, an exception in this situation is always emitted as a warning, leaving the surrounding <code>$@</code> untouched. In addition to object destructors, this also affects any function call run by XS code using the <code>G_KEEPERR</code> flag.</p>
</li>
<li><p>Warnings for <code>warn</code> can now be objects in the same way as exceptions for <code>die</code>. If an object-based warning gets the default handling of writing to standard error, it is stringified as before with the filename and line number appended. But a <code>$SIG{__WARN__}</code> handler now receives an object-based warning as an object, where previously it was passed the result of stringifying the object.</p>
</li>
</ul>
<h2 id="Other-Enhancements">Other Enhancements</h2>
<h3 id="Assignment-to-0-sets-the-legacy-process-name-with-prctl-on-Linux">Assignment to <code>$0</code> sets the legacy process name with prctl() on Linux</h3>
<p>On Linux the legacy process name is now set with <a href="http://man.he.net/man2/prctl">prctl(2)</a>, in addition to altering the POSIX name via <code>argv[0]</code>, as Perl has done since version 4.000. Now system utilities that read the legacy process name such as <i>ps</i>, <i>top</i>, and <i>killall</i> recognize the name you set when assigning to <code>$0</code>. The string you supply is truncated at 16 bytes; this limitation is imposed by Linux.</p>
<h3 id="srand-now-returns-the-seed">srand() now returns the seed</h3>
<p>This allows programs that need to have repeatable results not to have to come up with their own seed-generating mechanism. Instead, they can use srand() and stash the return value for future use. One example is a test program with too many combinations to test comprehensively in the time available for each run. It can test a random subset each time and, should there be a failure, log the seed used for that run so this can later be used to produce the same results.</p>
<h3 id="printf-like-functions-understand-post-1980-size-modifiers">printf-like functions understand post-1980 size modifiers</h3>
<p>Perl's printf and sprintf operators, and Perl's internal printf replacement function, now understand the C90 size modifiers "hh" (<code>char</code>), "z" (<code>size_t</code>), and "t" (<code>ptrdiff_t</code>). Also, when compiled with a C99 compiler, Perl now understands the size modifier "j" (<code>intmax_t</code>) (but this is not portable).</p>
<p>So, for example, on any modern machine, <code>sprintf("%hhd", 257)</code> returns "1".</p>
<h3 id="New-global-variable-GLOBAL_PHASE">New global variable <code>${^GLOBAL_PHASE}</code></h3>
<p>A new global variable, <code>${^GLOBAL_PHASE}</code>, has been added to allow introspection of the current phase of the Perl interpreter. It's explained in detail in <a href="/cperl/perlvar.html#GLOBAL_PHASE">"${^GLOBAL_PHASE}" in perlvar</a> and in <a href="/cperl/perlmod.html#BEGIN-UNITCHECK-CHECK-INIT-and-END">"BEGIN, UNITCHECK, CHECK, INIT and END" in perlmod</a>.</p>
<h3 id="d:-foo-calls-Devel::foo::unimport"><code>-d:-foo</code> calls <code>Devel::foo::unimport</code></h3>
<p>The syntax <b>-d:foo</b> was extended in 5.6.1 to make <b>-d:foo=bar</b> equivalent to <b>-MDevel::foo=bar</b>, which expands internally to <code>use Devel::foo 'bar'</code>. Perl now allows prefixing the module name with <b>-</b>, with the same semantics as <b>-M</b>; that is:</p>
<dl>
<dt id="d:-foo"><code>-d:-foo</code></dt>
<dd>
<p>Equivalent to <b>-M-Devel::foo</b>: expands to <code>no Devel::foo</code> and calls <code>Devel::foo->unimport()</code> if that method exists.</p>
</dd>
<dt id="d:-foo-bar"><code>-d:-foo=bar</code></dt>
<dd>
<p>Equivalent to <b>-M-Devel::foo=bar</b>: expands to <code>no Devel::foo 'bar'</code>, and calls <code>Devel::foo->unimport("bar")</code> if that method exists.</p>
</dd>
</dl>
<p>This is particularly useful for suppressing the default actions of a <code>Devel::*</code> module's <code>import</code> method whilst still loading it for debugging.</p>
<h3 id="Filehandle-method-calls-load-IO::File-on-demand">Filehandle method calls load <a href="/cperl/lib/IO/File.html">IO::File</a> on demand</h3>
<p>When a method call on a filehandle would die because the method cannot be resolved and <a href="/cperl/lib/IO/File.html">IO::File</a> has not been loaded, Perl now loads <a href="/cperl/lib/IO/File.html">IO::File</a> via <code>require</code> and attempts method resolution again:</p>
<pre><code> open my $fh, ">", $file;
$fh->binmode(":raw"); # loads IO::File and succeeds</code></pre>
<p>This also works for globs like <code>STDOUT</code>, <code>STDERR</code>, and <code>STDIN</code>:</p>
<pre><code> STDOUT->autoflush(1);</code></pre>
<p>Because this on-demand load happens only if method resolution fails, the legacy approach of manually loading an <a href="/cperl/lib/IO/File.html">IO::File</a> parent class for partial method support still works as expected:</p>
<pre><code> use IO::Handle;
open my $fh, ">", $file;
$fh->autoflush(1); # IO::File not loaded</code></pre>
<h3 id="Improved-IPv6-support">Improved IPv6 support</h3>
<p>The <code>Socket</code> module provides new affordances for IPv6, including implementations of the <code>Socket::getaddrinfo()</code> and <code>Socket::getnameinfo()</code> functions, along with related constants and a handful of new functions. See <a href="/cperl/lib/Socket.html">Socket</a>.</p>
<h3 id="DTrace-probes-now-include-package-name">DTrace probes now include package name</h3>
<p>The <code>DTrace</code> probes now include an additional argument, <code>arg3</code>, which contains the package the subroutine being entered or left was compiled in.</p>
<p>For example, using the following DTrace script:</p>
<pre><code> perl$target:::sub-entry
{
printf("%s::%s\n", copyinstr(arg0), copyinstr(arg3));
}</code></pre>
<p>and then running:</p>
<pre><code> $ perl -e 'sub test { }; test'</code></pre>
<p><code>DTrace</code> will print:</p>
<pre><code> main::test</code></pre>
<h2 id="New-C-APIs">New C APIs</h2>
<p>See <a href="#Internal-Changes">"Internal Changes"</a>.</p>
<h1 id="Security">Security</h1>
<h2 id="User-defined-regular-expression-properties">User-defined regular expression properties</h2>
<p><a href="/cperl/perlunicode.html#User-Defined-Character-Properties">"User-Defined Character Properties" in perlunicode</a> documented that you can create custom properties by defining subroutines whose names begin with "In" or "Is". However, Perl did not actually enforce that naming restriction, so <code>\p{foo::bar}</code> could call foo::bar() if it existed. The documented convention is now enforced.</p>
<p>Also, Perl no longer allows tainted regular expressions to invoke a user-defined property. It simply dies instead [perl #82616].</p>
<h1 id="Incompatible-Changes">Incompatible Changes</h1>
<p>Perl 5.14.0 is not binary-compatible with any previous stable release.</p>
<p>In addition to the sections that follow, see <a href="#C-API-Changes">"C API Changes"</a>.</p>
<h2 id="Regular-Expressions-and-String-Escapes">Regular Expressions and String Escapes</h2>
<h3 id="Inverted-bracketed-character-classes-and-multi-character-folds">Inverted bracketed character classes and multi-character folds</h3>
<p>Some characters match a sequence of two or three characters in <code>/i</code> regular expression matching under Unicode rules. One example is <code>LATIN SMALL LETTER SHARP S</code> which matches the sequence <code>ss</code>.</p>
<pre><code> 'ss' =~ /\A[\N{LATIN SMALL LETTER SHARP S}]\z/i # Matches</code></pre>
<p>This, however, can lead to very counter-intuitive results, especially when inverted. Because of this, Perl 5.14 does not use multi-character <code>/i</code> matching in inverted character classes.</p>
<pre><code> 'ss' =~ /\A[^\N{LATIN SMALL LETTER SHARP S}]+\z/i # ???</code></pre>
<p>This should match any sequences of characters that aren't the <code>SHARP S</code> nor what <code>SHARP S</code> matches under <code>/i</code>. <code>"s"</code> isn't <code>SHARP S</code>, but Unicode says that <code>"ss"</code> is what <code>SHARP S</code> matches under <code>/i</code>. So which one "wins"? Do you fail the match because the string has <code>ss</code> or accept it because it has an <code>s</code> followed by another <code>s</code>?</p>
<p>Earlier releases of Perl did allow this multi-character matching, but due to bugs, it mostly did not work.</p>
<h3 id="pod-400--777">\400-\777</h3>
<p>In certain circumstances, <code>\400</code>-<code>\777</code> in regexes have behaved differently than they behave in all other doublequote-like contexts. Since 5.10.1, Perl has issued a deprecation warning when this happens. Now, these literals behave the same in all doublequote-like contexts, namely to be equivalent to <code>\x{100}</code>-<code>\x{1FF}</code>, with no deprecation warning.</p>
<p>Use of <code>\400</code>-<code>\777</code> in the command-line option <b>-0</b> retain their conventional meaning. They slurp whole input files; previously, this was documented only for <b>-0777</b>.</p>
<p>Because of various ambiguities, you should use the new <code>\o{...}</code> construct to represent characters in octal instead.</p>
<h3 id="Most-p-properties-are-now-immune-to-case-insensitive-matching">Most <code>\p{}</code> properties are now immune to case-insensitive matching</h3>
<p>For most Unicode properties, it doesn't make sense to have them match differently under <code>/i</code> case-insensitive matching. Doing so can lead to unexpected results and potential security holes. For example</p>
<pre><code> m/\p{ASCII_Hex_Digit}+/i</code></pre>
<p>could previously match non-ASCII characters because of the Unicode matching rules (although there were several bugs with this). Now matching under <code>/i</code> gives the same results as non-<code>/i</code> matching except for those few properties where people have come to expect differences, namely the ones where casing is an integral part of their meaning, such as <code>m/\p{Uppercase}/i</code> and <code>m/\p{Lowercase}/i</code>, both of which match the same code points as matched by <code>m/\p{Cased}/i</code>. Details are in <a href="/cperl/perlrecharclass.html#Unicode-Properties">"Unicode Properties" in perlrecharclass</a>.</p>
<p>User-defined property handlers that need to match differently under <code>/i</code> must be changed to read the new boolean parameter passed to them, which is non-zero if case-insensitive matching is in effect and 0 otherwise. See <a href="/cperl/perlunicode.html#User-Defined-Character-Properties">"User-Defined Character Properties" in perlunicode</a>.</p>
<h3 id="p-implies-Unicode-semantics">\p{} implies Unicode semantics</h3>
<p>Specifying a Unicode property in the pattern indicates that the pattern is meant for matching according to Unicode rules, the way <code>\N{<i>NAME</i>}</code> does.</p>
<h3 id="Regular-expressions-retain-their-localeness-when-interpolated">Regular expressions retain their localeness when interpolated</h3>
<p>Regular expressions compiled under <code>use locale</code> now retain this when interpolated into a new regular expression compiled outside a <code>use locale</code>, and vice-versa.</p>
<p>Previously, one regular expression interpolated into another inherited the localeness of the surrounding regex, losing whatever state it originally had. This is considered a bug fix, but may trip up code that has come to rely on the incorrect behaviour.</p>
<h3 id="Stringification-of-regexes-has-changed">Stringification of regexes has changed</h3>
<p>Default regular expression modifiers are now notated using <code>(?^...)</code>. Code relying on the old stringification will fail. This is so that when new modifiers are added, such code won't have to keep changing each time this happens, because the stringification will automatically incorporate the new modifiers.</p>
<p>Code that needs to work properly with both old- and new-style regexes can avoid the whole issue by using (for perls since 5.9.5; see <a href="/cperl/lib/re.html">re</a>):</p>
<pre><code> use re qw(regexp_pattern);
my ($pat, $mods) = regexp_pattern($re_ref);</code></pre>
<p>If the actual stringification is important or older Perls need to be supported, you can use something like the following:</p>
<pre><code> # Accept both old and new-style stringification
my $modifiers = (qr/foobar/ =~ /\Q(?^/) ? "^" : "-xism";</code></pre>
<p>And then use <code>$modifiers</code> instead of <code>-xism</code>.</p>
<h3 id="Run-time-code-blocks-in-regular-expressions-inherit-pragmata">Run-time code blocks in regular expressions inherit pragmata</h3>
<p>Code blocks in regular expressions (<code>(?{...})</code> and <code>(??{...})</code>) previously did not inherit pragmata (strict, warnings, etc.) if the regular expression was compiled at run time as happens in cases like these two:</p>
<pre><code> use re "eval";
$foo =~ $bar; # when $bar contains (?{...})
$foo =~ /$bar(?{ $finished = 1 })/;</code></pre>
<p>This bug has now been fixed, but code that relied on the buggy behaviour may need to be fixed to account for the correct behaviour.</p>
<h2 id="Stashes-and-Package-Variables">Stashes and Package Variables</h2>
<h3 id="Localised-tied-hashes-and-arrays-are-no-longed-tied">Localised tied hashes and arrays are no longed tied</h3>
<p>In the following:</p>
<pre><code> tie @a, ...;
{
local @a;
# here, @a is a now a new, untied array
}
# here, @a refers again to the old, tied array</code></pre>
<p>Earlier versions of Perl incorrectly tied the new local array. This has now been fixed. This fix could however potentially cause a change in behaviour of some code.</p>
<h3 id="Stashes-are-now-always-defined">Stashes are now always defined</h3>
<p><code>defined %Foo::</code> now always returns true, even when no symbols have yet been defined in that package.</p>
<p>This is a side-effect of removing a special-case kludge in the tokeniser, added for 5.10.0, to hide side-effects of changes to the internal storage of hashes. The fix drastically reduces hashes' memory overhead.</p>
<p>Calling defined on a stash has been deprecated since 5.6.0, warned on lexicals since 5.6.0, and warned for stashes and other package variables since 5.12.0. <code>defined %hash</code> has always exposed an implementation detail: emptying a hash by deleting all entries from it does not make <code>defined %hash</code> false. Hence <code>defined %hash</code> is not valid code to determine whether an arbitrary hash is empty. Instead, use the behaviour of an empty <code>%hash</code> always returning false in scalar context.</p>
<h3 id="Clearing-stashes">Clearing stashes</h3>
<p>Stash list assignment <code>%foo:: = ()</code> used to make the stash temporarily anonymous while it was being emptied. Consequently, any of its subroutines referenced elsewhere would become anonymous, showing up as "(unknown)" in <code>caller</code>. They now retain their package names such that <code>caller</code> returns the original sub name if there is still a reference to its typeglob and "foo::__ANON__" otherwise [perl #79208].</p>
<h3 id="Dereferencing-typeglobs">Dereferencing typeglobs</h3>
<p>If you assign a typeglob to a scalar variable:</p>
<pre><code> $glob = *foo;</code></pre>
<p>the glob that is copied to <code>$glob</code> is marked with a special flag indicating that the glob is just a copy. This allows subsequent assignments to <code>$glob</code> to overwrite the glob. The original glob, however, is immutable.</p>
<p>Some Perl operators did not distinguish between these two types of globs. This would result in strange behaviour in edge cases: <code>untie $scalar</code> would not untie the scalar if the last thing assigned to it was a glob (because it treated it as <code>untie *$scalar</code>, which unties a handle). Assignment to a glob slot (such as <code>*$glob = \@some_array</code>) would simply assign <code>\@some_array</code> to <code>$glob</code>.</p>
<p>To fix this, the <code>*{}</code> operator (including its <code>*foo</code> and <code>*$foo</code> forms) has been modified to make a new immutable glob if its operand is a glob copy. This allows operators that make a distinction between globs and scalars to be modified to treat only immutable globs as globs. (<code>tie</code>, <code>tied</code> and <code>untie</code> have been left as they are for compatibility's sake, but will warn. See <a href="#Deprecations">"Deprecations"</a>.)</p>
<p>This causes an incompatible change in code that assigns a glob to the return value of <code>*{}</code> when that operator was passed a glob copy. Take the following code, for instance:</p>
<pre><code> $glob = *foo;
*$glob = *bar;</code></pre>
<p>The <code>*$glob</code> on the second line returns a new immutable glob. That new glob is made an alias to <code>*bar</code>. Then it is discarded. So the second assignment has no effect.</p>
<p>See <a href="http://rt.perl.org/rt3/Public/Bug/Display.html?id=77810">http://rt.perl.org/rt3/Public/Bug/Display.html?id=77810</a> for more detail.</p>
<h3 id="Magic-variables-outside-the-main-package">Magic variables outside the main package</h3>
<p>In previous versions of Perl, magic variables like <code>$!</code>, <code>%SIG</code>, etc. would "leak" into other packages. So <code>%foo::SIG</code> could be used to access signals, <code>${"foo::!"}</code> (with strict mode off) to access C's <code>errno</code>, etc.</p>
<p>This was a bug, or an "unintentional" feature, which caused various ill effects, such as signal handlers being wiped when modules were loaded, etc.</p>
<p>This has been fixed (or the feature has been removed, depending on how you see it).</p>
<h3 id="local-_-strips-all-magic-from-_">local($_) strips all magic from $_</h3>
<p>local() on scalar variables gives them a new value but keeps all their magic intact. This has proven problematic for the default scalar variable $_, where <a href="/cperl/perlsub.html">perlsub</a> recommends that any subroutine that assigns to $_ should first localize it. This would throw an exception if $_ is aliased to a read-only variable, and could in general have various unintentional side-effects.</p>
<p>Therefore, as an exception to the general rule, local($_) will not only assign a new value to $_, but also remove all existing magic from it as well.</p>
<h3 id="Parsing-of-package-and-variable-names">Parsing of package and variable names</h3>
<p>Parsing the names of packages and package variables has changed: multiple adjacent pairs of colons, as in <code>foo::::bar</code>, are now all treated as package separators.</p>
<p>Regardless of this change, the exact parsing of package separators has never been guaranteed and is subject to change in future Perl versions.</p>
<h2 id="Changes-to-Syntax-or-to-Perl-Operators">Changes to Syntax or to Perl Operators</h2>
<h3 id="given-return-values"><code>given</code> return values</h3>
<p><code>given</code> blocks now return the last evaluated expression, or an empty list if the block was exited by <code>break</code>. Thus you can now write:</p>
<pre><code> my $type = do {
given ($num) {
break when undef;
"integer" when /^[+-]?[0-9]+$/;
"float" when /^[+-]?[0-9]+(?:\.[0-9]+)?$/;
"unknown";
}
};</code></pre>
<p>See <a href="/cperl/perlsyn.html#Return-value">"Return value" in perlsyn</a> for details.</p>
<h3 id="Change-in-parsing-of-certain-prototypes">Change in parsing of certain prototypes</h3>
<p>Functions declared with the following prototypes now behave correctly as unary functions:</p>
<pre><code> *
\$ \% \@ \* \&
\[...]
;$ ;*
;\$ ;\% etc.
;\[...]</code></pre>
<p>Due to this bug fix [perl #75904], functions using the <code>(*)</code>, <code>(;$)</code> and <code>(;*)</code> prototypes are parsed with higher precedence than before. So in the following example:</p>
<pre><code> sub foo(;$);
foo $a < $b;</code></pre>
<p>the second line is now parsed correctly as <code>foo($a) < $b</code>, rather than <code>foo($a < $b)</code>. This happens when one of these operators is used in an unparenthesised argument:</p>
<pre><code> < > <= >= lt gt le ge
== != <=> eq ne cmp ~~
&
| ^
&&
|| //
.. ...
?:
= += -= *= etc.
, =></code></pre>
<h3 id="Smart-matching-against-array-slices">Smart-matching against array slices</h3>
<p>Previously, the following code resulted in a successful match:</p>
<pre><code> my @a = qw(a y0 z);
my @b = qw(a x0 z);
@a[0 .. $#b] ~~ @b;</code></pre>
<p>This odd behaviour has now been fixed [perl #77468].</p>
<h3 id="Negation-treats-strings-differently-from-before">Negation treats strings differently from before</h3>
<p>The unary negation operator, <code>-</code>, now treats strings that look like numbers as numbers [perl #57706].</p>
<h3 id="Negative-zero">Negative zero</h3>
<p>Negative zero (-0.0), when converted to a string, now becomes "0" on all platforms. It used to become "-0" on some, but "0" on others.</p>
<p>If you still need to determine whether a zero is negative, use <code>sprintf("%g", $zero) =~ /^-/</code> or the <a>Data::Float</a> module on CPAN.</p>
<h3 id="is-now-a-syntax-error"><code>:=</code> is now a syntax error</h3>
<p>Previously <code>my $pi := 4</code> was exactly equivalent to <code>my $pi : = 4</code>, with the <code>:</code> being treated as the start of an attribute list, ending before the <code>=</code>. The use of <code>:=</code> to mean <code>: =</code> was deprecated in 5.12.0, and is now a syntax error. This allows future use of <code>:=</code> as a new token.</p>
<p>Outside the core's tests for it, we find no Perl 5 code on CPAN using this construction, so we believe that this change will have little impact on real-world codebases.</p>
<p>If it is absolutely necessary to have empty attribute lists (for example, because of a code generator), simply avoid the error by adding a space before the <code>=</code>.</p>
<h3 id="Change-in-the-parsing-of-identifiers">Change in the parsing of identifiers</h3>
<p>Characters outside the Unicode "XIDStart" set are no longer allowed at the beginning of an identifier. This means that certain accents and marks that normally follow an alphabetic character may no longer be the first character of an identifier.</p>
<h2 id="Threads-and-Processes">Threads and Processes</h2>
<h3 id="Directory-handles-not-copied-to-threads">Directory handles not copied to threads</h3>
<p>On systems other than Windows that do not have a <code>fchdir</code> function, newly-created threads no longer inherit directory handles from their parent threads. Such programs would usually have crashed anyway [perl #75154].</p>
<h3 id="close-on-shared-pipes"><code>close</code> on shared pipes</h3>
<p>To avoid deadlocks, the <code>close</code> function no longer waits for the child process to exit if the underlying file descriptor is still in use by another thread. It returns true in such cases.</p>
<h3 id="fork-emulation-will-not-wait-for-signalled-children">fork() emulation will not wait for signalled children</h3>
<p>On Windows parent processes would not terminate until all forked children had terminated first. However, <code>kill("KILL", ...)</code> is inherently unstable on pseudo-processes, and <code>kill("TERM", ...)</code> might not get delivered if the child is blocked in a system call.</p>
<p>To avoid the deadlock and still provide a safe mechanism to terminate the hosting process, Perl now no longer waits for children that have been sent a SIGTERM signal. It is up to the parent process to waitpid() for these children if child-cleanup processing must be allowed to finish. However, it is also then the responsibility of the parent to avoid the deadlock by making sure the child process can't be blocked on I/O.</p>
<p>See <a href="/cperl/perlfork.html">perlfork</a> for more information about the fork() emulation on Windows.</p>
<h2 id="Configuration">Configuration</h2>
<h3 id="Naming-fixes-in-Policy_sh.SH-may-invalidate-Policy.sh">Naming fixes in Policy_sh.SH may invalidate Policy.sh</h3>
<p>Several long-standing typos and naming confusions in <i>Policy_sh.SH</i> have been fixed, standardizing on the variable names used in <i>config.sh</i>.</p>
<p>This will change the behaviour of <i>Policy.sh</i> if you happen to have been accidentally relying on its incorrect behaviour.</p>
<h3 id="Perl-source-code-is-read-in-text-mode-on-Windows">Perl source code is read in text mode on Windows</h3>
<p>Perl scripts used to be read in binary mode on Windows for the benefit of the <a href="/cperl/lib/ByteLoader.html">ByteLoader</a> module (which is no longer part of core Perl). This had the side-effect of breaking various operations on the <code>DATA</code> filehandle, including seek()/tell(), and even simply reading from <code>DATA</code> after filehandles have been flushed by a call to system(), backticks, fork() etc.</p>
<p>The default build options for Windows have been changed to read Perl source code on Windows in text mode now. <a href="/cperl/lib/ByteLoader.html">ByteLoader</a> will (hopefully) be updated on CPAN to automatically handle this situation [perl #28106].</p>
<h1 id="Deprecations">Deprecations</h1>
<p>See also <a href="#Deprecated-C-APIs">"Deprecated C APIs"</a>.</p>
<h2 id="Omitting-a-space-between-a-regular-expression-and-subsequent-word">Omitting a space between a regular expression and subsequent word</h2>
<p>Omitting the space between a regular expression operator or its modifiers and the following word is deprecated. For example, <code>m/foo/sand $bar</code> is for now still parsed as <code>m/foo/s and $bar</code>, but will now issue a warning.</p>
<h2 id="cX"><code>\c<i>X</i></code></h2>
<p>The backslash-c construct was designed as a way of specifying non-printable characters, but there were no restrictions (on ASCII platforms) on what the character following the <code>c</code> could be. Now, a deprecation warning is raised if that character isn't an ASCII character. Also, a deprecation warning is raised for <code>"\c{"</code> (which is the same as simply saying <code>";"</code>).</p>
<h2 id="b-and-B"><code>"\b{"</code> and <code>"\B{"</code></h2>
<p>In regular expressions, a literal <code>"{"</code> immediately following a <code>"\b"</code> (not in a bracketed character class) or a <code>"\B{"</code> is now deprecated to allow for its future use by Perl itself.</p>
<h2 id="Perl-4-era-.pl-libraries">Perl 4-era .pl libraries</h2>
<p>Perl bundles a handful of library files that predate Perl 5. This bundling is now deprecated for most of these files, which are now available from CPAN. The affected files now warn when run, if they were installed as part of the core.</p>
<p>This is a mandatory warning, not obeying <b>-X</b> or lexical warning bits. The warning is modelled on that supplied by <i>deprecate.pm</i> for deprecated-in-core <i>.pm</i> libraries. It points to the specific CPAN distribution that contains the <i>.pl</i> libraries. The CPAN versions, of course, do not generate the warning.</p>
<h2 id="List-assignment-to">List assignment to <code>$[</code></h2>
<p>Assignment to <code>$[</code> was deprecated and started to give warnings in Perl version 5.12.0. This version of Perl (5.14) now also emits a warning when assigning to <code>$[</code> in list context. This fixes an oversight in 5.12.0.</p>
<h2 id="Use-of-qw-...-as-parentheses">Use of qw(...) as parentheses</h2>
<p>Historically the parser fooled itself into thinking that <code>qw(...)</code> literals were always enclosed in parentheses, and as a result you could sometimes omit parentheses around them:</p>
<pre><code> for $x qw(a b c) { ... }</code></pre>
<p>The parser no longer lies to itself in this way. Wrap the list literal in parentheses like this:</p>
<pre><code> for $x (qw(a b c)) { ... }</code></pre>
<p>This is being deprecated because the parentheses in <code>for $i (1,2,3) { ... }</code> are not part of expression syntax. They are part of the statement syntax, with the <code>for</code> statement wanting literal parentheses. The synthetic parentheses that a <code>qw</code> expression acquired were only intended to be treated as part of expression syntax.</p>
<p>Note that this does not change the behaviour of cases like:</p>
<pre><code> use POSIX qw(setlocale localeconv);
our @EXPORT = qw(foo bar baz);</code></pre>
<p>where parentheses were never required around the expression.</p>
<h2 id="N-BELL"><code>\N{BELL}</code></h2>
<p>This is because Unicode is using that name for a different character. See <a href="#Unicode-Version-6.0-is-now-supported-mostly">"Unicode Version 6.0 is now supported (mostly)"</a> for more explanation.</p>
<h2 id="PATTERN"><code>?PATTERN?</code></h2>
<p><code>?PATTERN?</code> (without the initial <code>m</code>) has been deprecated and now produces a warning. This is to allow future use of <code>?</code> in new operators. The match-once functionality is still available as <code>m?PATTERN?</code>.</p>
<h2 id="Tie-functions-on-scalars-holding-typeglobs">Tie functions on scalars holding typeglobs</h2>
<p>Calling a tie function (<code>tie</code>, <code>tied</code>, <code>untie</code>) with a scalar argument acts on a filehandle if the scalar happens to hold a typeglob.</p>
<p>This is a long-standing bug that will be removed in Perl 5.16, as there is currently no way to tie the scalar itself when it holds a typeglob, and no way to untie a scalar that has had a typeglob assigned to it.</p>
<p>Now there is a deprecation warning whenever a tie function is used on a handle without an explicit <code>*</code>.</p>
<h2 id="User-defined-case-mapping">User-defined case-mapping</h2>
<p>This feature is being deprecated due to its many issues, as documented in <a href="/cperl/perlunicode.html#User-Defined-Case-Mappings-for-serious-hackers-only">"User-Defined Case Mappings (for serious hackers only)" in perlunicode</a>. This feature will be removed in Perl 5.16. Instead use the CPAN module <a>Unicode::Casing</a>, which provides improved functionality.</p>
<h2 id="Deprecated-modules">Deprecated modules</h2>
<p>The following module will be removed from the core distribution in a future release, and should be installed from CPAN instead. Distributions on CPAN that require this should add it to their prerequisites. The core version of these module now issues a deprecation warning.</p>
<p>If you ship a packaged version of Perl, either alone or as part of a larger system, then you should carefully consider the repercussions of core module deprecations. You may want to consider shipping your default build of Perl with a package for the deprecated module that installs into <code>vendor</code> or <code>site</code> Perl library directories. This will inhibit the deprecation warnings.</p>
<p>Alternatively, you may want to consider patching <i>lib/deprecate.pm</i> to provide deprecation warnings specific to your packaging system or distribution of Perl, consistent with how your packaging system or distribution manages a staged transition from a release where the installation of a single package provides the given functionality, to a later release where the system administrator needs to know to install multiple packages to get that same functionality.</p>
<p>You can silence these deprecation warnings by installing the module in question from CPAN. To install the latest version of it by role rather than by name, just install <code>Task::Deprecations::5_14</code>.</p>
<dl>
<dt id="Devel::DProf"><a>Devel::DProf</a></dt>
<dd>
<p>We strongly recommend that you install and use <a href="/cperl/lib/Devel/NYTProf.html">Devel::NYTProf</a> instead of <a>Devel::DProf</a>, as <a href="/cperl/lib/Devel/NYTProf.html">Devel::NYTProf</a> offers significantly improved profiling and reporting.</p>
</dd>
</dl>
<h1 id="Performance-Enhancements">Performance Enhancements</h1>
<h2 id="Safe-signals-optimisation">"Safe signals" optimisation</h2>