This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5160delta: The coreargs opcode is undeserving of mention
[perl5.git] / Porting / perl5160delta.pod
CommitLineData
30682cc3
RS
1=encoding utf8
2
3=head1 NAME
4
92221470 5perl5160delta - what is new for perl v5.16.0
30682cc3
RS
6
7=head1 DESCRIPTION
8
9This document describes differences between the 5.14.0 release and
10the 5.16.0 release.
11
12If you are upgrading from an earlier release such as 5.12.0, first read
13L<perl5140delta>, which describes differences between 5.12.0 and
145.14.0.
15
16=head1 Notice
17
0d0f20ee
RS
18As described in L<perlpolicy>, the release of Perl 5.16.0 marks the
19official end of support for Perl 5.12. Users of Perl 5.12 or earlier
20should consider upgrading to a more recent release of Perl.
30682cc3
RS
21
22=head1 Core Enhancements
23
412912b6
RS
24=head2 C<use I<VERSION>>
25
26As of this release, version declarations like C<use v5.16> now disable
27all features before enabling the new feature bundle. This means that
28the following holds true:
29
30 use 5.016;
a4574d2e 31 # only 5.16 features enabled here
412912b6 32 use 5.014;
a4574d2e 33 # only 5.14 features enabled here (not 5.16)
412912b6
RS
34
35C<use v5.12> and higher continue to enable strict, but explicit C<use
36strict> and C<no strict> now override the version declaration, even
37when they come first:
38
39 no strict;
40 use 5.012;
41 # no strict here
42
43There is a new ":default" feature bundle that represents the set of
44features enabled before any version declaration or C<use feature> has
45been seen. Version declarations below 5.10 now enable the ":default"
46feature set. This does not actually change the behaviour of C<use
47v5.8>, because features added to the ":default" set are those that were
48traditionally enabled by default, before they could be turned off.
49
6c0587ef
FC
50C<< no feature >> now resets to the default feature set. To disable all
51features (which is likely to be a pretty special-purpose request, since
52it presumably won't match any named set of semantics) you can now
53write C<< no feature ':all' >>.
54
412912b6
RS
55C<$[> is now disabled under C<use v5.16>. It is part of the default
56feature set and can be turned on or off explicitly with C<use feature
57'array_base'>.
58
a4574d2e
RS
59=head2 C<__SUB__>
60
61The new C<__SUB__> token, available under the C<current_sub> feature
021c503d 62(see L<feature>) or C<use v5.16>, returns a reference to the current
a4574d2e 63subroutine, making it easier to write recursive closures.
412912b6 64
a4574d2e 65=head2 New and Improved Built-ins
412912b6 66
a4574d2e
RS
67=head3 More consistent C<eval>
68
69The C<eval> operator sometimes treats a string argument as a sequence of
70characters and sometimes as a sequence of bytes, depending on the
71internal encoding. The internal encoding is not supposed to make any
72difference, but there is code that relies on this inconsistency.
73
74The new C<unicode_eval> and C<evalbytes> features (enabled under C<use
da7ea579 755.16.0>) resolve this. The C<unicode_eval> feature causes C<eval
a4574d2e
RS
76$string> to treat the string always as Unicode. The C<evalbytes>
77features provides a function, itself called C<evalbytes>, which
78evaluates its argument always as a string of bytes.
79
80These features also fix oddities with source filters leaking to outer
81dynamic scopes.
82
83See L<feature> for more detail.
84
85=head3 C<substr> lvalue revamp
86
22ae2565 87=for comment Does this belong here, or under Incomptable Changes?
412912b6
RS
88
89When C<substr> is called in lvalue or potential lvalue context with two
90or three arguments, a special lvalue scalar is returned that modifies
91the original string (the first argument) when assigned to.
92
93Previously, the offsets (the second and third arguments) passed to
94C<substr> would be converted immediately to match the string, negative
95offsets being translated to positive and offsets beyond the end of the
96string being truncated.
97
98Now, the offsets are recorded without modification in the special
99lvalue scalar that is returned, and the original string is not even
100looked at by C<substr> itself, but only when the returned lvalue is
101read or modified.
102
22ae2565 103These changes result in an incompatible change:
412912b6
RS
104
105If the original string changes length after the call to C<substr> but
106before assignment to its return value, negative offsets will remember
107their position from the end of the string, affecting code like this:
108
109 my $string = "string";
110 my $lvalue = \substr $string, -4, 2;
111 print $lvalue, "\n"; # prints "ri"
112 $string = "bailing twine";
113 print $lvalue, "\n"; # prints "wi"; used to print "il"
114
115The same thing happens with an omitted third argument. The returned
116lvalue will always extend to the end of the string, even if the string
117becomes longer.
118
22ae2565 119Since this change also allowed many bugs to be fixed (see
16f6a273 120L</The C<substr> operator>), and since the behaviour
22ae2565 121of negative offsets has never been specified, so the
412912b6
RS
122change was deemed acceptable.
123
a4574d2e 124=head3 Return value of C<tied>
412912b6
RS
125
126The value returned by C<tied> on a tied variable is now the actual
127scalar that holds the object to which the variable is tied. This
128allows ties to be weakened with C<Scalar::Util::weaken(tied
129$tied_variable)>.
130
a4574d2e 131=head2 Unicode Support
412912b6 132
77649ca9
RS
133=head3 Supports (I<almost>) Unicode 6.1
134
135Besides the addition of whole new scripts, and new characters in
136existing scripts, this new version of Unicode, as always, makes some
137changes to existing characters. One change that may trip up some
138applications is that the General Category of two characters in the
139Latin-1 range, PILCROW SIGN and SECTION SIGN, has been changed from
140Other_Symbol to Other_Punctuation. The same change has been made for
141a character in each of Tibetan, Ethiopic, and Aegean.
142The code points U+3248..U+324F (CIRCLED NUMBER TEN ON BLACK SQUARE
143through CIRCLED NUMBER EIGHTY ON BLACK SQUARE) have had their General
144Category changed from Other_Symbol to Other_Numeric. The Line Break
145property has changes for Hebrew and Japanese; and as a consequence of
146other changes in 6.1, the Perl regular expression construct C<\X> now
147works differently for some characters in Thai and Lao.
148
149New aliases (synonyms) have been defined for many property values;
7adddc81 150these, along with the previously existing ones, are all cross-indexed in
77649ca9
RS
151L<perluniprops>.
152
153The return value of C<charnames::viacode()> is affected by other
154changes:
155
156 Code point Old Name New Name
157 U+000A LINE FEED (LF) LINE FEED
158 U+000C FORM FEED (FF) FORM FEED
159 U+000D CARRIAGE RETURN (CR) CARRIAGE RETURN
160 U+0085 NEXT LINE (NEL) NEXT LINE
161 U+008E SINGLE-SHIFT 2 SINGLE-SHIFT-2
162 U+008F SINGLE-SHIFT 3 SINGLE-SHIFT-3
163 U+0091 PRIVATE USE 1 PRIVATE USE-1
164 U+0092 PRIVATE USE 2 PRIVATE USE-2
165 U+2118 SCRIPT CAPITAL P WEIERSTRASS ELLIPTIC FUNCTION
166
167Perl will accept any of these names as input, but
168C<charnames::viacode()> now returns the new name of each pair. The
169change for U+2118 is considered by Unicode to be a correction, that is
170the original name was a mistake (but again, it will remain forever valid
171to use it to refer to U+2118). But most of these changes are the
172fallout of the mistake Unicode 6.0 made in naming a character used in
7adddc81
FC
173Japanese cell phones to be "BELL", which conflicts with the longstanding
174industry use of (and Unicode's recommendation to use) that name
77649ca9
RS
175to mean the ASCII control character at U+0007. As a result, that name
176has been deprecated in Perl since v5.14; and any use of it will raise a
177warning message (unless turned off). The name "ALERT" is now the
178preferred name for this code point, with "BEL" being an acceptable short
179form. The name for the new cell phone character, at code point U+1F514,
180remains undefined in this version of Perl (hence we don't quite
181implement all of Unicode 6.1), but starting in v5.18, BELL will mean
182this character, and not U+0007.
183
184Unicode has taken steps to make sure that this sort of mistake does not
185happen again. The Standard now includes all the generally accepted
186names and abbreviations for control characters, whereas previously it
187didn't (though there were recommended names for most of them, which Perl
188used). This means that most of those recommended names are now
189officially in the Standard. Unicode did not recommend names for the
190four code points listed above between U+008E and U+008F, and in
191standardizing them Unicode subtly changed the names that Perl had
192previously given them, by replacing the final blank in each name by a
193hyphen. Unicode also officially accepts names that Perl had deprecated,
194such as FILE SEPARATOR. Now the only deprecated name is BELL.
195Finally, Perl now uses the new official names instead of the old
196(now considered obsolete) names for the first four code points in the
197list above (the ones which have the parentheses in them).
198
199Now that the names have been placed in the Unicode standard, these kinds
200of changes should not happen again, though corrections, such as to
201U+2118, are still possible.
202
203Unicode also added some name abbreviations, which Perl now accepts:
204SP for SPACE;
205TAB for CHARACTER TABULATION;
206NEW LINE, END OF LINE, NL, and EOL for LINE FEED;
207LOCKING-SHIFT ONE for SHIFT OUT;
208LOCKING-SHIFT ZERO for SHIFT IN;
209and ZWNBSP for ZERO WIDTH NO-BREAK SPACE.
210
211More details on this version of Unicode are provided in
212L<http://www.unicode.org/versions/Unicode6.1.0/>.
213
a4574d2e 214=head3 C<use charnames> is no longer needed for C<\N{I<name>}>
12477442 215
a4574d2e
RS
216When C<\N{I<name>}> is encountered, the C<charnames> module is now
217automatically loaded when needed as if the C<:full> and C<:short>
218options had been specified. See L<charnames> for more information.
12477442 219
021c503d
RS
220=head3 C<\N{...}> can now have Unicode loose name matching
221
222This is described in the C<charnames> item in
223L</Updated Modules and Pragmata> below.
224
a4574d2e 225=head3 Unicode Symbol Names
12477442
RS
226
227Perl now has proper support for Unicode in symbol names. It used to be
228that C<*{$foo}> would ignore the internal UTF8 flag and use the bytes of
229the underlying representation to look up the symbol. That meant that
230C<*{"\x{100}"}> and C<*{"\xc4\x80"}> would return the same thing. All
231these parts of Perl have been fixed to account for Unicode:
232
233=over
234
235=item *
236
237Method names (including those passed to C<use overload>)
238
239=item *
240
241Typeglob names (including names of variables, subroutines and filehandles)
242
243=item *
244
245Package names
246
247=item *
248
12477442
RS
249C<goto>
250
251=item *
252
253Symbolic dereferencing
254
255=item *
256
257Second argument to C<bless()> and C<tie()>
258
259=item *
260
261Return value of C<ref()>
262
263=item *
264
12477442
RS
265Subroutine prototypes
266
267=item *
268
269Attributes
270
a4574d2e
RS
271=item *
272
273Various warnings and error messages that mention variable names or values,
274methods, etc.
275
276=back
277
278In addition, a parsing bug has been fixed that prevented C<*{Ć©}> from
279implicitly quoting the name, but instead interpreted it as C<*{+Ć©}>, which
280would cause a strict violation.
281
282C<*{"*a::b"}> automatically strips off the * if it is followed by an ASCII
283letter. That has been extended to all Unicode identifier characters.
284
da7ea579
RS
285One-character non-ASCII non-punctuation variables (like C<$Ć©>) are now
286subject to "Used only once" warnings. They used to be exempt, as they
287was treated as punctuation variables.
a4574d2e 288
cb592430 289Also, single-character Unicode punctuation variables (like C<$ā€°>) are now
da7ea579 290supported [perl #69032].
a4574d2e 291
77649ca9
RS
292=head3 Improved ability to mix locales and Unicode, including UTF-8 locales
293
294An optional parameter has been added to C<use locale>
295
296 use locale ':not_characters';
297
298which tells Perl to use all but the C<LC_CTYPE> and C<LC_COLLATE>
299portions of the current locale. Instead, the character set is assumed
300to be Unicode. This allows locales and Unicode to be seamlessly mixed,
301including the increasingly frequent UTF-8 locales. When using this
302hybrid form of locales, the C<:locale> layer to the L<open> pragma can
303be used to interface with the file system, and there are CPAN modules
304available for ARGV and environment variable conversions.
305
306Full details are in L<perllocale>.
307
308=head3 New function C<fc> and corresponding escape sequence C<\F> for Unicode foldcase
309
310Unicode foldcase is an extension to lowercase that gives better results
311when comparing two strings case-insensitively. It has long been used
312internally in regular expression C</i> matching. Now it is available
313explicitly through the new C<fc> function call (enabled by
314S<C<"use feature 'fc'">>, or C<use v5.16>, or explicitly callable via
315C<CORE::fc>) or through the new C<\F> sequence in double-quotish
316strings.
317
318Full details are in L<perlfunc/fc>.
319
320=head3 The Unicode C<Script_Extensions> property is now supported.
a4574d2e
RS
321
322New in Unicode 6.0, this is an improved C<Script> property. Details
323are in L<perlunicode/Scripts>.
324
a4574d2e
RS
325=head2 XS Changes
326
021c503d 327=head3 Improved typemaps for Some Builtin Types
a4574d2e
RS
328
329Most XS authors will be aware that there is a longstanding bug in the
330OUTPUT typemap for T_AVREF (C<AV*>), T_HVREF (C<HV*>), T_CVREF (C<CV*>),
331and T_SVREF (C<SVREF> or C<\$foo>) that requires manually decrementing
332the reference count of the return value instead of the typemap taking
4d6200df
FC
333care of this. For backwards-compatibility, this cannot be changed in the
334default typemaps. But we now provide additional typemaps
a4574d2e
RS
335C<T_AVREF_REFCOUNT_FIXED>, etc. that do not exhibit this bug. Using
336them in your extension is as simple as having one line in your
337C<TYPEMAP> section:
338
339 HV* T_HVREF_REFCOUNT_FIXED
340
341=head3 C<is_utf8_char()>
342
343The XS-callable function C<is_utf8_char()>, when presented with
344malformed UTF-8 input, can read up to 12 bytes beyond the end of the
345string. This cannot be fixed without changing its API. It is not
346called from CPAN. The documentation now describes how to use it
347safely.
348
77649ca9
RS
349=head3 Added C<is_utf8_char_buf()>
350
351This function is designed to replace the deprecated L</is_utf8_char()>
352function. It includes an extra parameter to make sure it doesn't read
353past the end of the input buffer.
354
a4574d2e
RS
355=head3 Other C<is_utf8_foo()> functions, as well as C<utf8_to_foo()>, etc.
356
357Most of the other XS-callable functions that take UTF-8 encoded input
358implicitly assume that the UTF-8 is valid (not malformed) in regards to
359buffer length. Do not do things such as change a character's case or
360see if it is alphanumeric without first being sure that it is valid
361UTF-8. This can be safely done for a whole string by using one of the
362functions C<is_utf8_string()>, C<is_utf8_string_loc()>, and
363C<is_utf8_string_loclen()>.
364
021c503d
RS
365=head3 New Pad API
366
367Many new functions have been added to the API for manipulating lexical
368pads. See L<perlapi/Pad Data Structures> for more information.
369
a4574d2e
RS
370=head2 Changes to Special Variables
371
021c503d
RS
372=head3 C<$$> can be assigned to
373
374C<$$> was made read-only in Perl 5.8.0. But only sometimes: C<local $$>
375would make it writable again. Some CPAN modules were using C<local $$> or
376XS code to bypass the read-only check, so there is no reason to keep C<$$>
377read-only. (This change also allowed a bug to be fixed while maintaining
378backward compatibility.)
379
380=head3 C<$^X> converted to an absolute path on FreeBSD, OS X and Solaris
381
382C<$^X> is now converted to an absolute path on OS X, FreeBSD (without
4d6200df 383needing F</proc> mounted) and Solaris 10 and 11. This augments the
021c503d
RS
384previous approach of using F</proc> on Linux, FreeBSD and NetBSD
385(in all cases, where mounted).
386
387This makes relocatable perl installations more useful on these platforms.
388(See "Relocatable @INC" in F<INSTALL>)
a4574d2e
RS
389
390=head2 Debugger Changes
391
392=head3 Features inside the debugger
393
394The current Perl's L<feature> bundle is now enabled for commands entered
395in the interactive debugger.
396
397=head3 New option for the debugger's B<t> command
398
399The B<t> command in the debugger, which toggles tracing mode, now
400accepts a numeric argument that determines how many levels of subroutine
401calls to trace.
402
403=head3 C<enable> and C<disable>
404
405The debugger now has C<disable> and C<enable> commands for disabling
da7ea579 406existing breakpoints and re-enabling them. See L<perldebug>.
a4574d2e
RS
407
408=head3 Breakpoints with file names
409
410The debugger's "b" command for setting breakpoints now allows a line
411number to be prefixed with a file name. See
412L<perldebug/"b [file]:[line] [condition]">.
413
414=head2 The C<CORE> Namespace
415
a40c91f0 416=head3 The C<CORE::> prefix
a4574d2e
RS
417
418The C<CORE::> prefix can now be used on keywords enabled by
a40c91f0 419L<feature.pm|feature>, even outside the scope of C<use feature>.
a4574d2e 420
a40c91f0 421=head3 Subroutines in the C<CORE> namespace
a4574d2e 422
a40c91f0
FC
423Many Perl keywords are now available as subroutines in the CORE namespace.
424This allows them to be aliased:
425
426 BEGIN { *entangle = \&CORE::tie }
427 entangle $variable, $package, @args;
428
429And for prototypes to be bypassed:
430
431 sub mytie(\[%$*@]$@) {
432 my ($ref, $pack, @args) = @_;
433 ... do something ...
434 goto &CORE::tie;
435 }
436
437Some of these cannot be called through references or via C<&foo> syntax,
438but must be called as barewords.
439
440See L<CORE> for details.
a4574d2e
RS
441
442=head2 Other Changes
443
021c503d
RS
444=head3 Anonymous handles
445
446Automatically generated file handles are now named __ANONIO__ when the
447variable name cannot be determined, rather than $__ANONIO__.
448
449=head3 Autoloaded sort Subroutines
450
451Custom sort subroutines can now be autoloaded [perl #30661]:
452
453 sub AUTOLOAD { ... }
454 @sorted = sort foo @list; # uses AUTOLOAD
455
456=head3 C<continue> no longer requires the "switch" feature
457
458The C<continue> keyword has two meanings. It can introduce a C<continue>
459block after a loop, or it can exit the current C<when> block. Up till now,
460the latter meaning was only valid with the "switch" feature enabled, and
461was a syntax error otherwise. Since the main purpose of feature.pm is to
462avoid conflicts with user-defined subroutines, there is no reason for
463C<continue> to depend on it.
464
021c503d
RS
465=head3 DTrace probes for interpreter phase change
466
467The C<phase-change> probes will fire when the interpreter's phase
4d6200df
FC
468changes, which tracks the C<${^GLOBAL_PHASE}> variable. C<arg0> is
469the new phase name; C<arg1> is the old one. This is useful mostly
021c503d
RS
470for limiting your instrumentation to one or more of: compile time,
471run time, destruct time.
472
473=head3 C<__FILE__()> Syntax
474
475The C<__FILE__>, C<__LINE__> and C<__PACKAGE__> tokens can now be written
476with an empty pair of parentheses after them. This makes them parse the
477same way as C<time>, C<fork> and other built-in functions.
a4574d2e 478
f4ff5ee7
FC
479=head3 The C<\$> prototype accepts any scalar lvalue
480
481The C<\$> and C<\[$]> subroutine prototypes now accept any scalar lvalue
482argument. Previously they only accepted scalars beginning with C<$> and
483hash and array elements. This change makes them consistent with the way
484the built-in C<read> and C<recv> functions (among others) parse their
485arguments. This means that one can override the built-in functions with
486custom subroutines that parse their arguments the same way.
487
488=head3 C<_> in subroutine prototypes
77649ca9
RS
489
490The C<_> character in subroutine prototypes is now allowed before C<@> or
491C<%>.
492
a4574d2e
RS
493=head1 Security
494
77649ca9
RS
495=head2 Use C<is_utf8_char_buf()> and not C<is_utf8_char()>
496
497The latter function is now deprecated because its API is insufficient to
498guarantee that it doesn't read (up to 12 bytes in the worst case) beyond
499the end of its input string. See
500L<is_utf8_char_buf()|/Added is_utf8_char_buf()>.
501
662ded96
FC
502=head2 Malformed UTF-8 input could cause attempts to read beyond the end of the buffer
503
504Two new XS-accessible functions, C<utf8_to_uvchr_buf()> and
505C<utf8_to_uvuni_buf()> are now available to prevent this, and the Perl
506core has been converted to use them.
507See L</Internal Changes>.
508
a4574d2e
RS
509=head2 C<File::Glob::bsd_glob()> memory error with GLOB_ALTDIRFUNC (CVE-2011-2728).
510
511Calling C<File::Glob::bsd_glob> with the unsupported flag
512GLOB_ALTDIRFUNC would cause an access violation / segfault. A Perl
513program that accepts a flags value from an external source could expose
514itself to denial of service or arbitrary code execution attacks. There
515are no known exploits in the wild. The problem has been corrected by
516explicitly disabling all unsupported flags and setting unused function
517pointers to null. Bug reported by ClƩment Lecigne.
518
519=head2 Privileges are now set correctly when assigning to C<$(>
520
521A hypothetical bug (probably non-exploitable in practice) due to the
522incorrect setting of the effective group ID while setting C<$(> has been
523fixed. The bug would only have affected systems that have C<setresgid()>
524but not C<setregid()>, but no such systems are known of.
525
526=head1 Deprecations
527
528=head2 Don't read the Unicode data base files in F<lib/unicore>
529
530It is now deprecated to directly read the Unicode data base files.
531These are stored in the F<lib/unicore> directory. Instead, you should
532use the new functions in L<Unicode::UCD>. These provide a stable API,
021c503d 533and give complete information.
a4574d2e
RS
534
535Perl may at some point in the future change or remove the files. The
536file most likely for applications to have used is
537F<lib/unicore/ToDigit.pl>. L<Unicode::UCD/prop_invmap()> can be used to
538get at its data instead.
539
662ded96
FC
540=head2 XS functions C<is_utf8_char()>, C<utf8_to_uvchr()> and
541C<utf8_to_uvuni()>
77649ca9
RS
542
543This function is deprecated because it could read beyond the end of the
662ded96
FC
544input string. Use the new L<is_utf8_char_buf()|/Added is_utf8_char_buf()>,
545C<utf8_to_uvchr_buf()> and C<utf8_to_uvuni_buf()> instead.
77649ca9 546
a4574d2e
RS
547=head1 Future Deprecations
548
2200e649 549This section serves as a notice of features that are I<likely> to be
021c503d
RS
550removed or L<deprecated|perlpolicy/deprecated> in the next release of
551perl (5.18.0). If your code depends on these features, you should
552contact the Perl 5 Porters via the L<mailing
a4574d2e
RS
553list|http://lists.perl.org/list/perl5-porters.html> or L<perlbug> to
554explain your use case and inform the deprecation process.
555
556=head2 Core Modules
557
558These modules may be marked as deprecated I<from the core>. This only
559means that they will no longer be installed by default with the core
560distribution, but will remain available on the CPAN.
561
562=over
563
021c503d 564=item *
a4574d2e 565
021c503d 566CPANPLUS
a4574d2e 567
021c503d 568=item *
a4574d2e 569
021c503d 570Filter::Simple
a4574d2e 571
021c503d 572=item *
a4574d2e 573
021c503d 574PerlIO::mmap
a4574d2e 575
021c503d 576=item *
a4574d2e 577
021c503d 578Pod::Parser, Pod::LaTeX
a4574d2e 579
021c503d 580=item *
a4574d2e 581
021c503d 582SelfLoader
a4574d2e 583
021c503d 584=item *
a4574d2e 585
021c503d 586Text::Soundex
a4574d2e 587
021c503d 588=item *
a4574d2e 589
021c503d 590Thread.pm
a4574d2e
RS
591
592=back
593
021c503d 594=head2 Platforms with no supporting programmers:
12477442 595
2200e649
FC
596These platforms will probably have their
597special build support removed during the
021c503d 5985.17.0 development series.
12477442
RS
599
600=over
601
602=item *
603
021c503d 604BeOS
12477442
RS
605
606=item *
607
021c503d 608djgpp
12477442
RS
609
610=item *
611
021c503d 612dgux
12477442
RS
613
614=item *
615
021c503d 616EPOC
12477442
RS
617
618=item *
619
021c503d 620MPE/iX
12477442
RS
621
622=item *
623
021c503d 624Rhapsody
12477442
RS
625
626=item *
627
021c503d 628UTS
12477442
RS
629
630=item *
631
021c503d 632VM/ESA
12477442
RS
633
634=back
635
021c503d 636=head2 Other Future Deprecations
a14d7d4a 637
021c503d 638=over
ccad93fd 639
021c503d 640=item *
ccad93fd 641
021c503d 642Swapping of $< and $>
ccad93fd 643
da7ea579
RS
644For more information about this future deprecation, see L<the relevant RT
645ticket|https://rt.perl.org/rt3/Ticket/Display.html?id=96212>.
ccad93fd 646
021c503d 647=item *
ccad93fd 648
021c503d 649sfio, stdio
ccad93fd 650
6d365783
FC
651=item *
652
653Unescaped literal C<< "{" >> in regular expressions.
654
ddfbda00
FC
655It is planned starting in v5.20 to require a literal C<"{"> to be
656escaped by, for example, preceding it with a backslash. In v5.18, a
657deprecated warning message will be emitted for all such uses. Note that
658this only affects patterns which are to match a literal C<"{">. Other
659uses of this character, such as part of a quantifier or sequence like in
660the ones below are completely unaffected:
661
662 /foo{3,5}/
663 /\p{Alphabetic}/
664 /\N{DIGIT ZERO}
665
666The removal of this will allow extensions to pattern syntax, and better
667error checking of existing syntax. See L<perlre/Quantifiers> for an
668example.
669
021c503d 670=back
30682cc3 671
021c503d 672=head1 Incompatible Changes
94c11dd4 673
77649ca9
RS
674=head2 Special blocks called in void context
675
676Special blocks (C<BEGIN>, C<CHECK>, C<INIT>, C<UNITCHECK>, C<END>) are now
677called in void context. This avoids wasteful copying of the result of the
678last statement [perl #108794].
679
680=head2 The C<overloading> pragma and regexp objects
681
682With C<no overloading>, regular expression objects returned by C<qr//> are
683now stringified as "Regexp=REGEXP(0xbe600d)" instead of the regular
684expression itself [perl #108780].
685
686=head2 Two XS typemap Entries removed
687
688Two presumably unused XS typemap entries have been removed from the
4d6200df 689core typemap: T_DATAUNIT and T_CALLBACK. If you are, against all odds,
77649ca9
RS
690a user of these, please see the instructions on how to regain them
691in L<perlxstypemap>.
692
693=head2 Unicode 6.1 has incompatibilities with Unicode 6.0
694
695These are detailed in L</Supports (almost) Unicode 6.1> above.
16737d47
KW
696You can compile this version of Perl to use Unicode 6.0. See
697L<perlunicode/Hacking Perl to work on earlier Unicode versions (for very serious hackers only)>.
77649ca9 698
021c503d 699=head2 Borland compiler
94c11dd4 700
021c503d
RS
701All support for the Borland compiler has been dropped. The code had not
702worked for a long time anyway.
30682cc3 703
b325a3a2
RS
704=head2 Certain deprecated Unicode properties are no longer supported by default
705
706Perl should never have exposed certain Unicode properties that are used
707by Unicode internally and not meant to be publicly available. Use of
708these has generated deprecated warning messages since Perl 5.12. The
709removed properties are Other_Alphabetic,
710Other_Default_Ignorable_Code_Point, Other_Grapheme_Extend,
711Other_ID_Continue, Other_ID_Start, Other_Lowercase, Other_Math, and
712Other_Uppercase.
713
714Perl may be recompiled to include any or all of them; instructions are
715given in
716L<perluniprops/Unicode character properties that are NOT accepted by Perl>.
717
718=head2 Dereferencing IO thingies as typeglobs
719
720The C<*{...}> operator, when passed a reference to an IO thingy (as in
721C<*{*STDIN{IO}}>), creates a new typeglob containing just that IO object.
b325a3a2
RS
722Previously, it would stringify as an empty string, but some operators would
723treat it as undefined, producing an "uninitialized" warning.
13eda273 724Now it stringifies as __ANONIO__ [perl #96326].
b325a3a2 725
132f64c4 726=head2 User-defined case-changing operations
4bbade93
RS
727
728This feature was deprecated in Perl 5.14, and has now been removed.
729The CPAN module L<Unicode::Casing> provides better functionality without
730the drawbacks that this feature had, as are detailed in the 5.14
731documentation:
732L<http://perldoc.perl.org/5.14.0/perlunicode.html#User-Defined-Case-Mappings-%28for-serious-hackers-only%29>
733
734=head2 XSUBs are now 'static'
735
736XSUB C functions are now 'static', that is, they are not visible from
4d6200df 737outside the compilation unit. Users can use the new C<XS_EXTERNAL(name)>
4bbade93
RS
738and C<XS_INTERNAL(name)> macros to pick the desired linking behaviour.
739The ordinary C<XS(name)> declaration for XSUBs will continue to declare
740non-'static' XSUBs for compatibility, but the XS compiler,
741C<ExtUtils::ParseXS> (C<xsubpp>) will emit 'static' XSUBs by default.
742C<ExtUtils::ParseXS>'s behaviour can be reconfigured from XS using the
270edcef 743C<EXPORT_XSUB_SYMBOLS> keyword. See L<perlxs> for details.
4bbade93 744
4bbade93
RS
745=head2 Weakening read-only references
746
747Weakening read-only references is no longer permitted. It should never
ef85823e 748have worked anyway, and in some cases could result in crashes.
4bbade93 749
a14d7d4a
RS
750=head2 Tying scalars that hold typeglobs
751
752Attempting to tie a scalar after a typeglob was assigned to it would
753instead tie the handle in the typeglob's IO slot. This meant that it was
754impossible to tie the scalar itself. Similar problems affected C<tied> and
755C<untie>: C<tied $scalar> would return false on a tied scalar if the last
756thing returned was a typeglob, and C<untie $scalar> on such a tied scalar
757would do nothing.
30682cc3 758
a14d7d4a
RS
759We fixed this problem before Perl 5.14.0, but it caused problems with some
760CPAN modules, so we put in a deprecation cycle instead.
30682cc3 761
a14d7d4a
RS
762Now the deprecation has been removed and this bug has been fixed. So
763C<tie $scalar> will always tie the scalar, not the handle it holds. To tie
764the handle, use C<tie *$scalar> (with an explicit asterisk). The same
765applies to C<tied *$scalar> and C<untie *$scalar>.
766
767=head2 IPC::Open3 no longer provides C<xfork()>, C<xclose_on_exec()>
768and C<xpipe_anon()>
769
770All three functions were private, undocumented and unexported. They do
771not appear to be used by any code on CPAN. Two have been inlined and one
772deleted entirely.
773
774=head2 C<$$> no longer caches PID
775
3af03643 776Previously, if one called fork(3) from C, Perl's
4d6200df 777notion of C<$$> could go out of sync with what getpid() returns. By always
a14d7d4a
RS
778fetching the value of C<$$> via getpid(), this potential bug is eliminated.
779Code that depends on the caching behavior will break. As described in
3af03643
FC
780L<Core Enhancements|/C<$$> can be assigned to>,
781C<$$> is now writable, but it will be reset during a
a14d7d4a 782fork.
30682cc3 783
77649ca9
RS
784=head2 C<$$> and C<getppid()> no longer emulate POSIX semantics under LinuxThreads
785
786The POSIX emulation of C<$$> and C<getppid()> under the obsolete
2a94ed8e
FC
787LinuxThreads implementation has been removed.
788This only impacts users of Linux 2.4 and
77649ca9
RS
789users of Debian GNU/kFreeBSD up to and including 6.0, not the vast
790majority of Linux installations that use NPTL threads.
791
37194c1a 792This means that C<getppid()>, like C<$$>, is now always guaranteed to
77649ca9
RS
793return the OS's idea of the current state of the process, not perl's
794cached version of it.
795
796See the documentation for L<$$|perlvar/$$> for details.
797
798=head2 C<< $< >>, C<< $> >>, C<$(> and C<$)> are no longer cached
799
37194c1a 800Similarly to the changes to C<$$> and C<getppid()>, the internal
77649ca9
RS
801caching of C<< $< >>, C<< $> >>, C<$(> and C<$)> has been removed.
802
803When we cached these values our idea of what they were would drift out
37194c1a 804of sync with reality if someone (e.g., someone embedding perl) called
04bd4d55 805C<sete?[ug]id()> without updating C<PL_e?[ug]id>. Having to deal with
77649ca9
RS
806this complexity wasn't worth it given how cheap the C<gete?[ug]id()>
807system call is.
808
809This change will break a handful of CPAN modules that use the XS-level
810C<PL_uid>, C<PL_gid>, C<PL_euid> or C<PL_egid> variables.
811
812The fix for those breakages is to use C<PerlProc_gete?[ug]id()> to
813retrieve them (e.g. C<PerlProc_getuid()>), and not to assign to
4d6200df 814C<PL_e?[ug]id> if you change the UID/GID/EUID/EGID. There is no longer
77649ca9
RS
815any need to do so since perl will always retrieve the up-to-date
816version of those values from the OS.
817
818=head2 Which Non-ASCII characters get quoted by C<quotemeta> and C<\Q> has changed
819
820This is unlikely to result in a real problem, as Perl does not attach
821special meaning to any non-ASCII character, so it is currently
822irrelevant which are quoted or not. This change fixes bug [perl #77654] and
823bring Perl's behavior more into line with Unicode's recommendations.
824See L<perlfunc/quotemeta>.
825
a4574d2e 826=head1 Performance Enhancements
6c3c09b8
RS
827
828=over
829
a4574d2e 830=item *
6c3c09b8 831
a4574d2e 832Improved performance for Unicode properties in regular expressions
6c3c09b8 833
a4574d2e 834=for comment Can this be compacted some? -- rjbs, 2012-02-20
6c3c09b8 835
a4574d2e
RS
836Matching a code point against a Unicode property is now done via a
837binary search instead of linear. This means for example that the worst
838case for a 1000 item property is 10 probes instead of 1000. This
839inefficiency has been compensated for in the past by permanently storing
840in a hash the results of a given probe plus the results for the adjacent
84164 code points, under the theory that near-by code points are likely to
842be searched for. A separate hash was used for each mention of a Unicode
843property in each regular expression. Thus, C<qr/\p{foo}abc\p{foo}/>
844would generate two hashes. Any probes in one instance would be unknown
845to the other, and the hashes could expand separately to be quite large
846if the regular expression were used on many different widely-separated
847code points. This can lead to running out of memory in extreme cases.
848Now, however, there is just one hash shared by all instances of a given
849property. This means that if C<\p{foo}> is matched against "A" in one
850regular expression in a thread, the result will be known immediately to
851all regular expressions, and the relentless march of using up memory is
852slowed considerably.
6c3c09b8 853
a4574d2e 854=item *
6c3c09b8 855
a4574d2e
RS
856Version declarations with the C<use> keyword (e.g., C<use 5.012>) are now
857faster, as they enable features without loading F<feature.pm>.
6c3c09b8 858
a4574d2e 859=item *
6c3c09b8 860
a4574d2e
RS
861C<local $_> is faster now, as it no longer iterates through magic that it
862is not going to copy anyway.
6c3c09b8 863
a4574d2e 864=item *
6c3c09b8 865
a4574d2e
RS
866Perl 5.12.0 sped up the destruction of objects whose classes define
867empty C<DESTROY> methods (to prevent autoloading), by simply not
868calling such empty methods. This release takes this optimisation a
869step further, by not calling any C<DESTROY> method that begins with a
870C<return> statement. This can be useful for destructors that are only
871used for debugging:
6c3c09b8 872
a4574d2e
RS
873 use constant DEBUG => 1;
874 sub DESTROY { return unless DEBUG; ... }
6c3c09b8 875
a4574d2e
RS
876Constant-folding will reduce the first statement to C<return;> if DEBUG
877is set to 0, triggering this optimisation.
6c3c09b8 878
a4574d2e 879=item *
6c3c09b8 880
a4574d2e
RS
881Assigning to a variable that holds a typeglob or copy-on-write scalar
882is now much faster. Previously the typeglob would be stringified or
883the copy-on-write scalar would be copied before being clobbered.
6c3c09b8 884
a4574d2e 885=item *
6c3c09b8 886
a4574d2e
RS
887Assignment to C<substr> in void context is now more than twice its
888previous speed. Instead of creating and returning a special lvalue
889scalar that is then assigned to, C<substr> modifies the original string
890itself.
6c3c09b8 891
a4574d2e 892=item *
6c3c09b8 893
a4574d2e
RS
894C<substr> no longer calculates a value to return when called in void
895context.
6c3c09b8 896
ccad93fd 897=item *
30682cc3 898
a4574d2e
RS
899Due to changes in L<File::Glob>, Perl's C<glob> function and its C<<
900<...> >> equivalent are now much faster. The splitting of the pattern
901into words has been rewritten in C, resulting in speed-ups of 20% in
902some cases.
b325a3a2 903
49f99971 904This does not affect C<glob> on VMS, as it does not use File::Glob.
b325a3a2
RS
905
906=item *
907
ccad93fd
RS
908The short-circuiting operators C<&&>, C<||>, and C<//>, when chained
909(such as C<$a || $b || $c>), are now considerably faster to short-circuit,
910due to reduced optree traversal.
30682cc3
RS
911
912=item *
913
ccad93fd
RS
914The implementation of C<s///r> makes one fewer copy of the scalar's value.
915
916=item *
917
021c503d 918C<study> is now a no-op.
ccad93fd
RS
919
920=item *
921
922Recursive calls to lvalue subroutines in lvalue scalar context use less
923memory.
30682cc3
RS
924
925=back
926
927=head1 Modules and Pragmata
928
cb82babd
RS
929=head2 Deprecated Modules
930
931=over
932
933=item L<Version::Requirements>
934
da7ea579 935Version::Requirements is now DEPRECATED, use L<CPAN::Meta::Requirements>,
4d6200df 936which is a drop-in replacement. It will be deleted from perl.git blead
cb82babd
RS
937in v5.17.0.
938
939=back
940
30682cc3
RS
941=head2 New Modules and Pragmata
942
943=over 4
944
945=item *
946
b325a3a2 947L<arybase> -- this new module implements the C<$[> variable.
30682cc3 948
77649ca9
RS
949=item *
950
951C<PerlIO::mmap> 0.010 has been added to the Perl core.
952
953The C<mmap> PerlIO layer is no longer implemented by perl itself, but has
954been moved out into the new L<PerlIO::mmap> module.
955
30682cc3
RS
956=back
957
958=head2 Updated Modules and Pragmata
959
960=over 4
961
962=item *
963
964L<XXX> has been upgraded from version 0.69 to version 0.70.
965
966=back
967
968=head2 Removed Modules and Pragmata
969
a14d7d4a
RS
970As promised in Perl 5.14.0's release notes, the following modules have
971been removed from the core distribution, and if needed should be installed
972from CPAN instead.
973
974=over
30682cc3
RS
975
976=item *
977
021c503d
RS
978C<Devel::DProf> has been removed from the Perl core. Prior version was
97920110228.00.
a14d7d4a
RS
980
981=item *
982
983C<Shell> has been removed from the Perl core. Prior version was 0.72_01.
30682cc3
RS
984
985=back
986
987=head1 Documentation
988
30682cc3
RS
989=head2 New Documentation
990
ccad93fd 991=head3 L<perldtrace>
30682cc3 992
ccad93fd
RS
993L<perldtrace> describes Perl's DTrace support, listing the provided probes
994and gives examples of their use.
30682cc3 995
94c11dd4
RS
996=head3 L<perlexperiment>
997
998This document is intended to provide a list of experimental features in
999Perl. It is still a work in progress.
1000
021c503d
RS
1001=head3 L<perlootut>
1002
4d6200df 1003This a new OO tutorial. It focuses on basic OO concepts, and then recommends
021c503d
RS
1004that readers choose an OO framework from CPAN.
1005
77649ca9
RS
1006=head3 L<perlxstypemap>
1007
1008The new manual describes the XS typemapping mechanism in unprecedented
1009detail and combines new documentation with information extracted from
1010L<perlxs> and the previously unofficial list of all core typemaps.
1011
30682cc3
RS
1012=head2 Changes to Existing Documentation
1013
021c503d
RS
1014=head3 L<perlapi>
1015
1016=over 4
1017
1018=item *
1019
1020The HV API has long accepted negative lengths to indicate that the key is
1021in UTF8. Now this is documented.
1022
1023=item *
1024
1025The C<boolSV()> macro is now documented.
1026
1027=back
1028
cb82babd
RS
1029=head3 L<perlfunc>
1030
1031=over 4
1032
1033=item *
1034
1035C<dbmopen> treats a 0 mode as a special case, that prevents a nonexistent
1036file from being created. This has been the case since Perl 5.000, but was
1037never documented anywhere. Now the perlfunc entry mentions it
1038[perl #90064].
1039
1040=item *
1041
021c503d
RS
1042As an accident of history, C<open $fh, "<:", ...> applies the default
1043layers for the platform (C<:raw> on Unix, C<:crlf> on Windows), ignoring
1044whatever is declared by L<open.pm|open>. This seems such a useful feature
1045it has been documented in L<perlfunc|perlfunc/open> and L<open>.
1046
1047=item *
1048
cb82babd
RS
1049The entry for C<split> has been rewritten. It is now far clearer than
1050before.
1051
1052=back
1053
021c503d 1054=head3 L<perlguts>
cb82babd
RS
1055
1056=over 4
1057
1058=item *
1059
021c503d
RS
1060A new section, L<Autoloading with XSUBs|perlguts/Autoloading with XSUBs>,
1061has been added, which explains the two APIs for accessing the name of the
1062autoloaded sub.
cb82babd
RS
1063
1064=item *
1065
021c503d
RS
1066Some of the function descriptions in L<perlguts> were confusing, as it was
1067not clear whether they referred to the function above or below the
1068description. This has been clarified [perl #91790].
cb82babd
RS
1069
1070=back
1071
021c503d 1072=head3 L<perlobj>
412912b6
RS
1073
1074=over 4
1075
1076=item *
1077
021c503d
RS
1078This document has been rewritten from scratch, and its coverage of various OO
1079concepts has been expanded.
412912b6
RS
1080
1081=back
1082
021c503d 1083=head3 L<perlop>
12477442
RS
1084
1085=over 4
1086
1087=item *
1088
021c503d
RS
1089Documentation of the smartmatch operator has been reworked and moved from
1090perlsyn to perlop where it belongs.
12477442 1091
021c503d
RS
1092It has also been corrected for the case of C<undef> on the left-hand
1093side. The list of different smart match behaviours had an item in the
1094wrong place.
12477442
RS
1095
1096=item *
1097
021c503d
RS
1098Documentation of the ellipsis statement (C<...>) has been reworked and
1099moved from perlop to perlsyn.
12477442
RS
1100
1101=item *
1102
021c503d
RS
1103The explanation of bitwise operators has been expanded to explain how they
1104work on Unicode strings (5.14.1).
12477442
RS
1105
1106=item *
1107
021c503d 1108More examples for C<m//g> have been added (5.14.1).
4bbade93
RS
1109
1110=item *
1111
021c503d 1112The C<<< <<\FOO >>> here-doc syntax has been documented (5.14.1).
4bbade93
RS
1113
1114=back
1115
1116=head3 L<perlpragma>
1117
1118=over 4
1119
1120=item *
1121
1122There is now a standard convention for naming keys in the C<%^H>,
1123documented under L<Key naming|perlpragma/Key naming>.
1124
1125=back
1126
021c503d 1127=head3 L<perlsec/Laundering and Detecting Tainted Data>
30682cc3 1128
021c503d 1129=over 4
ccad93fd
RS
1130
1131=item *
1132
021c503d
RS
1133The example function for checking for taintedness contained a subtle
1134error. C<$@> needs to be localized to prevent its changing this
1135global's value outside the function. The preferred method to check for
1136this remains L<Scalar::Util/tainted>.
ccad93fd
RS
1137
1138=back
1139
1140=head3 L<perllol>
1141
1142=over
1143
1144=item *
1145
1146L<perllol> has been expanded with examples using the new C<push $scalar>
1147syntax introduced in Perl 5.14.0 (5.14.1).
1148
1149=back
1150
1151=head3 L<perlmod>
1152
1153=over
1154
1155=item *
1156
1157L<perlmod> now states explicitly that some types of explicit symbol table
1158manipulation are not supported. This codifies what was effectively already
1159the case [perl #78074].
1160
1161=back
1162
ccad93fd
RS
1163=head3 L<perlpodstyle>
1164
1165=over 4
1166
1167=item *
1168
1169The tips on which formatting codes to use have been corrected and greatly
1170expanded.
1171
1172=item *
1173
1174There are now a couple of example one-liners for previewing POD files after
1175they have been edited.
1176
1177=back
1178
021c503d 1179=head3 L<perlre>
ccad93fd
RS
1180
1181=over
1182
1183=item *
1184
021c503d
RS
1185The C<(*COMMIT)> directive is now listed in the right section
1186(L<Verbs without an argument|perlre/Verbs without an argument>).
94c11dd4 1187
ccad93fd
RS
1188=back
1189
021c503d 1190=head3 L<perlrun>
ccad93fd
RS
1191
1192=over
1193
1194=item *
1195
021c503d
RS
1196L<perlrun> has undergone a significant clean-up. Most notably, the
1197B<-0x...> form of the B<-0> flag has been clarified, and the final section
1198on environment variables has been corrected and expanded (5.14.1).
ccad93fd
RS
1199
1200=back
1201
021c503d 1202=head3 L<perlsub>
ccad93fd
RS
1203
1204=over
1205
1206=item *
1207
021c503d
RS
1208The ($;) prototype syntax, which has existed for rather a long time, is now
1209documented in L<perlsub>. It allows a unary function to have the same
1210precedence as a list operator.
ccad93fd
RS
1211
1212=back
1213
1214=head3 L<perltie>
1215
1216=over
1217
1218=item *
1219
24391d94 1220The required syntax for tying handles has been documented.
ccad93fd
RS
1221
1222=back
1223
1224=head3 L<perlvar>
1225
1226=over
1227
1228=item *
1229
1230The documentation for L<$!|perlvar/$!> has been corrected and clarified.
1231It used to state that $! could be C<undef>, which is not the case. It was
1232also unclear as to whether system calls set C's C<errno> or Perl's C<$!>
1233[perl #91614].
1234
1235=item *
1236
1237Documentation for L<$$|perlvar/$$> has been amended with additional
1238cautions regarding changing the process ID.
1239
1240=back
30682cc3 1241
021c503d
RS
1242=head3 Other Changes
1243
30682cc3
RS
1244=over 4
1245
1246=item *
1247
ccad93fd
RS
1248L<perlxs> was extended with documentation on inline typemaps.
1249
1250=item *
1251
1252L<perlref> has a new L<Circular References|perlref/Circular References>
1253section explaining how circularities may not be freed and how to solve that
1254with weak references.
1255
1256=item *
1257
ccad93fd
RS
1258Parts of L<perlapi> were clarified, and Perl equivalents of some C
1259functions have been added as an additional mode of exposition.
1260
1261=item *
1262
1263A few parts of L<perlre> and L<perlrecharclass> were clarified.
30682cc3
RS
1264
1265=back
1266
4bbade93
RS
1267=head2 Removed Documentation
1268
1269=head3 Old OO Documentation
1270
1271All the old OO tutorials, perltoot, perltooc, and perlboot, have been
a4574d2e
RS
1272removed. The perlbot (bag of object tricks) document has been removed
1273as well.
4bbade93
RS
1274
1275=head3 Development Deltas
1276
021c503d
RS
1277The perldelta files for development releases are no longer packaged with
1278perl. These can still be found in the perl source code repository.
4bbade93 1279
30682cc3
RS
1280=head1 Diagnostics
1281
1282The following additions or changes have been made to diagnostic output,
1283including warnings and fatal error messages. For the complete list of
1284diagnostic messages, see L<perldiag>.
1285
30682cc3
RS
1286=head2 New Diagnostics
1287
30682cc3
RS
1288=head3 New Errors
1289
1290=over 4
1291
1292=item *
1293
cb82babd
RS
1294L<Cannot set tied @DB::args|perldiag/"Cannot set tied @DB::args">
1295
1296This error occurs when C<caller> tries to set C<@DB::args> but finds it
1297tied. Before this error was added, it used to crash instead.
1298
1299=item *
1300
1301L<Cannot tie unreifiable array|perldiag/"Cannot tie unreifiable array">
1302
1303This error is part of a safety check that the C<tie> operator does before
1304tying a special array like C<@_>. You should never see this message.
1305
1306=item *
1307
94c11dd4
RS
1308L<&CORE::%s cannot be called directly|perldiag/"&CORE::%s cannot be called directly">
1309
10c3c9ec 1310This occurs when a subroutine in the C<CORE::> namespace is called
4dbfa257 1311with C<&foo> syntax or through a reference. Some subroutines
94c11dd4 1312in this package cannot yet be called that way, but must be
10c3c9ec 1313called as barewords. See L</Subroutines in the C<CORE> namespace>, above.
30682cc3 1314
98a0da08
FC
1315=item *
1316
1317L<Source filters apply only to byte streams|perldiag/"Source filters apply only to byte streams">
1318
1319This new error occurs when you try to activate a source filter (usually by
1320loading a source filter module) within a string passed to C<eval> under the
1321C<unicode_eval> feature.
1322
30682cc3
RS
1323=back
1324
1325=head3 New Warnings
1326
1327=over 4
1328
b325a3a2
RS
1329=item *
1330
cb82babd
RS
1331L<defined(@array) is deprecated|perldiag/"defined(@array) is deprecated">
1332
1333The long-deprecated C<defined(@array)> now also warns for package variables.
1334Previously it only issued a warning for lexical variables.
1335
1336=item *
1337
98a0da08 1338L<length() used on %s|perldiag/length() used on %s>
cb82babd 1339
98a0da08
FC
1340This new warning occurs when C<length> is used on an array or hash, instead
1341of C<scalar(@array)> or C<scalar(keys %hash)>.
cb82babd
RS
1342
1343=item *
1344
98a0da08 1345L<lvalue attribute %s already-defined subroutine|perldiag/"lvalue attribute %s already-defined subroutine">
cb82babd 1346
98a0da08
FC
1347L<attributes.pm|attributes> now emits this warning when the :lvalue
1348attribute is applied to a Perl subroutine that has already been defined, as
1349doing so can have unexpected side-effects.
cb82babd 1350
cb82babd
RS
1351=item *
1352
98a0da08 1353L<overload arg '%s' is invalid|perldiag/"overload arg '%s' is invalid">
30682cc3 1354
98a0da08
FC
1355This warning, in the "overload" category, is produced when the overload
1356pragma is given an argument it doesn't recognize, presumably a mistyped
1357operator.
a14d7d4a 1358
b325a3a2
RS
1359=item *
1360
98a0da08 1361L<$[ used in %s (did you mean $] ?)|perldiag/"$[ used in %s (did you mean $] ?)">
b325a3a2 1362
98a0da08
FC
1363This new warning exists to catch the mistaken use of C<$[> in version
1364checks. C<$]>, not C<$[>, contains the version number.
b325a3a2
RS
1365
1366=item *
1367
98a0da08 1368L<Useless assignment to a temporary|perldiag/"Useless assignment to a temporary">
b325a3a2 1369
98a0da08
FC
1370Assigning to a temporary scalar returned
1371from an lvalue subroutine now produces this
1372warning [perl #31946].
b325a3a2
RS
1373
1374=item *
1375
98a0da08 1376L<Useless use of \E|perldiag/"Useless use of \E">
6d365783 1377
98a0da08 1378C<\E> does nothing unless preceded by C<\Q>, C<\L> or C<\U>.
6d365783 1379
a14d7d4a 1380=back
30682cc3 1381
482daec9 1382=head2 Removed Errors
cb82babd
RS
1383
1384=over
1385
1386=item *
1387
1388"sort is now a reserved word"
1389
a4574d2e
RS
1390This error used to occur when C<sort> was called without arguments,
1391followed by C<;> or C<)>. (E.g., C<sort;> would die, but C<{sort}> was
cb82babd
RS
1392OK.) This error message was added in Perl 3 to catch code like
1393C<close(sort)> which would no longer work. More than two decades later,
1394this message is no longer appropriate. Now C<sort> without arguments is
a4574d2e
RS
1395always allowed, and returns an empty list, as it did in those cases
1396where it was already allowed [perl #90030].
cb82babd
RS
1397
1398=back
1399
30682cc3
RS
1400=head2 Changes to Existing Diagnostics
1401
ccad93fd
RS
1402=over 4
1403
1404=item *
1405
1154aa6d
FC
1406The "Applying pattern match..." or similar warning produced when an
1407array or hash is on the left-hand side of the C<=~> operator now
1408mentions the name of the variable.
9f6b5e9d
FC
1409
1410=item *
1411
412912b6
RS
1412The "Attempt to free non-existent shared string" has had the spelling
1413of "non-existent" corrected to "nonexistent". It was already listed
1414with the correct spelling in L<perldiag>.
1415
1416=item *
1417
412912b6 1418The error messages for using C<default> and C<when> outside of a
a4574d2e
RS
1419topicalizer have been standardised to match the messages for C<continue>
1420and loop controls. They now read 'Can't "default" outside a
1421topicalizer' and 'Can't "when" outside a topicalizer'. They both used
1422to be 'Can't use when() outside a topicalizer' [perl #91514].
412912b6
RS
1423
1424=item *
1425
1154aa6d
FC
1426The message, "Code point 0x%X is not Unicode, no properties match it;
1427all inverse properties do" has been changed to "Code point 0x%X is not
1428Unicode, all \p{} matches fail; all \P{} matches succeed".
b325a3a2
RS
1429
1430=item *
1431
1154aa6d
FC
1432Redefinition warnings for constant subroutines used to be mandatory,
1433even occurring under C<no warnings>. Now they respect the L<warnings>
1434pragma.
1435
1436=item *
1437
1438The "glob failed" warning message is now suppressible via C<no warnings>
1439[perl #111656].
b325a3a2
RS
1440
1441=item *
1442
ccad93fd
RS
1443The L<Invalid version format|perldiag/"Invalid version format (%s)">
1444error message now says "negative version number" within the parentheses,
1445rather than "non-numeric data", for negative numbers.
1446
1447=item *
1448
1449The two warnings
1450L<Possible attempt to put comments in qw() list|perldiag/"Possible attempt to put comments in qw() list">
1451and
1452L<Possible attempt to separate words with commas|perldiag/"Possible attempt to separate words with commas">
021c503d
RS
1453are no longer mutually exclusive: the same C<qw> construct may produce
1454both.
30682cc3 1455
021c503d 1456=item *
412912b6 1457
1154aa6d
FC
1458The uninitialized warning for C<y///r> when C<$_> is implicit and
1459undefined now mentions the variable name, just like the non-/r variation
1460of the operator.
1461
1462=item *
1463
1464The 'Use of "foo" without parentheses is ambiguous' warning has been
1465extended to apply also to user-defined subroutines with a (;$)
1466prototype, and not just to built-in functions.
412912b6
RS
1467
1468=item *
30682cc3 1469
021c503d
RS
1470Warnings that mention the names of lexical (C<my>) variables with
1471Unicode characters in them now respect the presence or absence of the
1472C<:utf8> layer on the output handle, instead of outputting UTF8
1473regardless. Also, the correct names are included in the strings passed
1474to C<$SIG{__WARN__}> handlers, rather than the raw UTF8 bytes.
412912b6
RS
1475
1476=back
30682cc3 1477
021c503d
RS
1478=head1 Utility Changes
1479
4bbade93 1480=head3 L<h2ph>
30682cc3
RS
1481
1482=over 4
1483
1484=item *
1485
4bbade93
RS
1486L<h2ph> used to generate code of the form
1487
412912b6
RS
1488 unless(defined(&FOO)) {
1489 sub FOO () {42;}
1490 }
4bbade93
RS
1491
1492But the subroutine is a compile-time declaration, and is hence unaffected
1493by the condition. It has now been corrected to emit a string C<eval>
1494around the subroutine [perl #99368].
30682cc3
RS
1495
1496=back
1497
cb82babd
RS
1498=head3 L<splain>
1499
1500=over 4
1501
1502=item *
1503
a4574d2e
RS
1504F<splain> no longer emits backtraces with the first line number repeated.
1505
cb82babd
RS
1506This:
1507
1508 Uncaught exception from user code:
1509 Cannot fwiddle the fwuddle at -e line 1.
1510 at -e line 1
1511 main::baz() called at -e line 1
1512 main::bar() called at -e line 1
1513 main::foo() called at -e line 1
1514
1515has become this:
1516
1517 Uncaught exception from user code:
1518 Cannot fwiddle the fwuddle at -e line 1.
1519 main::baz() called at -e line 1
1520 main::bar() called at -e line 1
1521 main::foo() called at -e line 1
1522
1523=item *
1524
1525Some error messages consist of multiple lines that are listed as separate
1526entries in L<perldiag>. splain has been taught to find the separate
1527entries in these cases, instead of simply failing to find the message.
1528
1529=back
1530
021c503d
RS
1531=head3 L<zipdetails>
1532
1533=over 4
1534
1535=item *
1536
d0af4845
FC
1537This is a new utility, included as part of an
1538L<IO::Compress::Base> upgrade.
1539
021c503d
RS
1540L<zipdetails> displays information about the internal record structure
1541of the zip file. It is not concerned with displaying any details of
1542the compressed data stored in the zip file.
1543
1544=back
1545
30682cc3
RS
1546=head1 Configuration and Compilation
1547
a14d7d4a 1548=over 4
30682cc3 1549
a14d7d4a 1550=item *
30682cc3 1551
a14d7d4a
RS
1552F<regexp.h> has been modified for compatibility with GCC's B<-Werror>
1553option, as used by some projects that include perl's header files (5.14.1).
30682cc3
RS
1554
1555=item *
1556
a14d7d4a
RS
1557C<USE_LOCALE{,_COLLATE,_CTYPE,_NUMERIC}> have been added the output of perl -V
1558as they have affect the behaviour of the interpreter binary (albeit only
1559in a small area).
1560
1561=item *
1562
1563The code and tests for L<IPC::Open2> have been moved from F<ext/IPC-Open2>
1564into F<ext/IPC-Open3>, as C<IPC::Open2::open2()> is implemented as a thin
1565wrapper around C<IPC::Open3::_open3()>, and hence is very tightly coupled to
1566it.
1567
1568=item *
1569
1570The magic types and magic vtables are now generated from data in a new script
02750d38
RS
1571F<regen/mg_vtable.pl>, instead of being maintained by hand. As different
1572EBCDIC variants can't agree on the code point for '~', the character to code
1573point conversion is done at build time by F<generate_uudmap> to a new generated
1574header F<mg_data.h>. C<PL_vtbl_bm> and C<PL_vtbl_fm> are now defined by the
a14d7d4a
RS
1575pre-processor as C<PL_vtbl_regexp>, instead of being distinct C variables.
1576C<PL_vtbl_sig> has been removed.
1577
1578=item *
1579
02750d38 1580Building with C<-DPERL_GLOBAL_STRUCT> works again. This configuration is not
a14d7d4a
RS
1581generally used.
1582
1583=item *
1584
1585Perl configured with I<MAD> now correctly frees C<MADPROP> structures when
02750d38
RS
1586OPs are freed. C<MADPROP>s are now allocated with C<PerlMemShared_malloc()>
1587
1588=item *
1589
1590F<makedef.pl> has been refactored. This should have no noticeable affect on
1591any of the platforms that use it as part of their build (AIX, VMS, Win32).
1592
1593=item *
1594
1595C<useperlio> can no longer be disabled.
1596
1597=item *
1598
1599The file F<global.sym> is no longer needed, and has been removed. It
1600contained a list of all exported functions, one of the files generated by
1601F<regen/embed.pl> from data in F<embed.fnc> and F<regen/opcodes>. The code
1602has been refactored so that the only user of F<global.sym>, F<makedef.pl>,
1603now reads F<embed.fnc> and F<regen/opcodes> directly, removing the need to
1604store the list of exported functions in an intermediate file.
1605
1606As F<global.sym> was never installed, this change should not be visible
1607outside the build process.
1608
1609=item *
1610
1611F<pod/buildtoc>, used by the build process to build L<perltoc>, has been
1612refactored and simplified. It now only contains code to build L<perltoc>;
1613the code to regenerate Makefiles has been moved to F<Porting/pod_rules.pl>.
1614It's a bug if this change has any material effect on the build process.
1615
1616=item *
1617
1618F<pod/roffitall> is now built by F<pod/buildtoc>, instead of being
1619shipped with the distribution. Its list of manpages is now generated
1620(and therefore current). See also RT #103202 for an unresolved related
1621issue.
1622
1623=item *
1624
1625The man page for C<XS::Typemap> is no longer installed. C<XS::Typemap>
1626is a test module which is not installed, hence installing its
1627documentation makes no sense.
1628
1629=item *
1630
1631The -Dusesitecustomize and -Duserelocatableinc options now work
1632together properly.
a14d7d4a
RS
1633
1634=back
30682cc3 1635
30682cc3
RS
1636=head1 Platform Support
1637
30682cc3
RS
1638=head2 Platform-Specific Notes
1639
77649ca9
RS
1640=head3 Cygwin
1641
1642=over 4
1643
1644=item *
1645
4d6200df 1646Since version 1.7, Cygwin supports native UTF-8 paths. If Perl is built
77649ca9
RS
1647under that environment, directory and filenames will be UTF-8 encoded.
1648
4c29740d
FC
1649Cygwin does not initialize all original Win32 environment variables. See
1650F<README.cygwin> for a discussion of the newly-added
1651C<Cygwin::sync_winenv()> function [perl #110190] and for
77649ca9
RS
1652further links.
1653
1654=back
1655
fd6d17ce
RS
1656=head3 HP-UX
1657
1658=over 4
1659
1660=item *
1661
1662HP-UX PA-RISC/64 now supports gcc-4.x
1663
1664A fix to correct the socketsize now makes the test suite pass on HP-UX
1665PA-RISC for 64bitall builds.
1666
1667=back
1668
412912b6
RS
1669=head3 VMS
1670
30682cc3
RS
1671=over 4
1672
412912b6 1673=item *
30682cc3 1674
4bbade93
RS
1675Remove unnecessary includes, fix miscellaneous compiler warnings and
1676close some unclosed comments on F<vms/vms.c>.
1677
1678Remove sockadapt layer from the VMS build.
30682cc3 1679
412912b6
RS
1680=item *
1681
412912b6
RS
1682Explicit support for VMS versions prior to v7.0 and DEC C versions
1683prior to v6.0 has been removed.
1684
1685=item *
1686
1687Since Perl 5.10.1, the home-grown C<stat> wrapper has been unable to
1688distinguish between a directory name containing an underscore and an
1689otherwise-identical filename containing a dot in the same position
1690(e.g., t/test_pl as a directory and t/test.pl as a file). This problem
1691has been corrected.
1692
77649ca9
RS
1693=item *
1694
1695The build on VMS now allows names of the resulting symbols in C code for
1696Perl longer than 31 characters. Symbols like
1697C<Perl__it_was_the_best_of_times_it_was_the_worst_of_times> can now be
1698created freely without causing the VMS linker to seize up.
1699
412912b6
RS
1700=back
1701
1702=head3 GNU/Hurd
b325a3a2
RS
1703
1704Numerous build and test failures on GNU/Hurd have been resolved with hints
1705for building DBM modules, detection of the library search path, and enabling
1706of large file support.
1707
412912b6 1708=head3 OpenVOS
b325a3a2
RS
1709
1710Perl is now built with dynamic linking on OpenVOS, the minimum supported
1711version of which is now Release 17.1.0.
1712
412912b6 1713=head3 SunOS
b325a3a2
RS
1714
1715The CC workshop C++ compiler is now detected and used on systems that ship
1716without cc.
1717
30682cc3
RS
1718=head1 Internal Changes
1719
4bbade93 1720=over 4
30682cc3 1721
4bbade93 1722=item *
30682cc3 1723
470722b4 1724The compiled representation of formats is now stored via the C<mg_ptr> of
3e307570
FC
1725their C<PERL_MAGIC_fm>. Previously it was stored in the string buffer,
1726beyond C<SvLEN()>, the regular end of the string. C<SvCOMPILED()> and
470722b4
RS
1727C<SvCOMPILED_{on,off}()> now exist solely for compatibility for XS code.
1728The first is always 0, the other two now no-ops. (5.14.1)
cb82babd 1729
470722b4
RS
1730=item *
1731
1732Some global variables have been marked C<const>, members in the interpreter
3e307570
FC
1733structure have been re-ordered, and the opcodes have been re-ordered. The
1734op C<OP_AELEMFAST> has been split into C<OP_AELEMFAST> and C<OP_AELEMFAST_LEX>.
cb82babd
RS
1735
1736=item *
1737
470722b4
RS
1738When empting a hash of its elements (e.g. via undef(%h), or %h=()), HvARRAY
1739field is no longer temporarily zeroed. Any destructors called on the freed
3e307570
FC
1740elements see the remaining elements. Thus, %h=() becomes more like
1741C<delete $h{$_} for keys %h>.
cb82babd
RS
1742
1743=item *
1744
470722b4 1745Boyer-Moore compiled scalars are now PVMGs, and the Boyer-Moore tables are now
3e307570
FC
1746stored via the mg_ptr of their C<PERL_MAGIC_bm>.
1747Previously they were PVGVs, with the tables stored in
1748the string buffer, beyond C<SvLEN()>. This eliminates
470722b4
RS
1749the last place where the core stores data beyond C<SvLEN()>.
1750
1751=item *
1752
1753Simplified logic in C<Perl_sv_magic()> introduces a small change of
3e307570 1754behaviour for error cases involving unknown magic types. Previously, if
470722b4
RS
1755C<Perl_sv_magic()> was passed a magic type unknown to it, it would
1756
1757=over
1758
1759=item 1.
1760
1761Croak "Modification of a read-only value attempted" if read only
1762
1763=item 2.
1764
1765Return without error if the SV happened to already have this magic
1766
1767=item 3.
1768
1769otherwise croak "Don't know how to handle magic of type \\%o"
1770
1771=back
1772
1773Now it will always croak "Don't know how to handle magic of type \\%o", even
1774on read only values, or SVs which already have the unknown magic type.
1775
1776=item *
1777
1778The experimental C<fetch_cop_label> function has been renamed to
1779C<cop_fetch_label>.
1780
1781=item *
1782
1783The C<cop_store_label> function has been added to the API, but is
1784experimental.
1785
1786=item *
1787
1788F<embedvar.h> has been simplified, and one level of macro indirection for
1789PL_* variables has been removed for the default (non-multiplicity)
3e307570 1790configuration. PERLVAR*() macros now directly expand their arguments to
470722b4 1791tokens such as C<PL_defgv>, instead of expanding to C<PL_Idefgv>, with
3e307570 1792F<embedvar.h> defining a macro to map C<PL_Idefgv> to C<PL_defgv>. XS code
470722b4 1793which has unwarranted chumminess with the implementation may need updating.
470722b4
RS
1794
1795=item *
1796
1797An API has been added to explicitly choose whether or not to export XSUB
1798symbols. More detail can be found in the comments for commit e64345f8.
cb82babd 1799
cb82babd
RS
1800=item *
1801
4bbade93
RS
1802The C<is_gv_magical_sv> function has been eliminated and merged with
1803C<gv_fetchpvn_flags>. It used to be called to determine whether a GV
1804should be autovivified in rvalue context. Now it has been replaced with a
1805new C<GV_ADDMG> flag (not part of the API).
30682cc3
RS
1806
1807=item *
1808
4bbade93
RS
1809Padlists are now marked C<AvREAL>; i.e., reference-counted. They have
1810always been reference-counted, but were not marked real, because F<pad.c>
1811did its own clean-up, instead of using the usual clean-up code in F<sv.c>.
1812That caused problems in thread cloning, so now the C<AvREAL> flag is on,
1813but is turned off in F<pad.c> right before the padlist is freed (after
1814F<pad.c> has done its custom freeing of the pads).
1815
1816=item *
1817
1818All the C files that make up the Perl core have been converted to UTF-8.
30682cc3 1819
470722b4
RS
1820=item *
1821
1822These new functions have been added as part of the work on Unicode symbols:
1823
1824 HvNAMELEN
1825 HvNAMEUTF8
1826 HvENAMELEN
1827 HvENAMEUTF8
1828 gv_init_pv
1829 gv_init_pvn
1830 gv_init_pvsv
1831 gv_fetchmeth_pv
1832 gv_fetchmeth_pvn
1833 gv_fetchmeth_sv
1834 gv_fetchmeth_pv_autoload
1835 gv_fetchmeth_pvn_autoload
1836 gv_fetchmeth_sv_autoload
1837 gv_fetchmethod_pv_flags
1838 gv_fetchmethod_pvn_flags
1839 gv_fetchmethod_sv_flags
1840 gv_autoload_pv
1841 gv_autoload_pvn
1842 gv_autoload_sv
1843 newGVgen_flags
1844 sv_derived_from_pv
1845 sv_derived_from_pvn
1846 sv_derived_from_sv
1847 sv_does_pv
1848 sv_does_pvn
1849 sv_does_sv
1850 whichsig_pv
1851 whichsig_pvn
1852 whichsig_sv
1853 newCONSTSUB_flags
1854
1855The gv_fetchmethod_*_flags functions, like gv_fetchmethod_flags, are
1856experimental and may change in a future release.
1857
1858=item *
1859
1860The following functions were added. These are I<not> part of the API:
1861
1862 GvNAMEUTF8
1863 GvENAMELEN
1864 GvENAME_HEK
1865 CopSTASH_flags
1866 CopSTASH_flags_set
1867 PmopSTASH_flags
1868 PmopSTASH_flags_set
1869 sv_sethek
1870 HEKfARG
1871
1872There is also a C<HEKf> macro corresponding to C<SVf>, for
1873interpolating HEKs in formatted strings.
1874
1875=item *
1876
1877C<sv_catpvn_flags> takes a couple of new internal-only flags,
1878C<SV_CATBYTES> and C<SV_CATUTF8>, which tell it whether the char array to
1879be concatenated is UTF8. This allows for more efficient concatenation than
1880creating temporary SVs to pass to C<sv_catsv>.
1881
1882=item *
1883
1884For XS AUTOLOAD subs, $AUTOLOAD is set once more, as it was in 5.6.0. This
1885is in addition to setting C<SvPVX(cv)>, for compatibility with 5.8 to 5.14.
1886See L<perlguts/Autoloading with XSUBs>.
1887
1888=item *
1889
1890Perl now checks whether the array (the linearised isa) returned by a MRO
1891plugin begins with the name of the class itself, for which the array was
1892created, instead of assuming that it does. This prevents the first element
1893from being skipped during method lookup. It also means that
1894C<mro::get_linear_isa> may return an array with one more element than the
1895MRO plugin provided [perl #94306].
1896
1897=item *
1898
1899C<PL_curstash> is now reference-counted.
1900
1901=item *
1902
1903There are now feature bundle hints in C<PL_hints> (C<$^H>) that version
1904declarations use, to avoid having to load F<feature.pm>. One setting of
1905the hint bits indicates a "custom" feature bundle, which means that the
1906entries in C<%^H> still apply. F<feature.pm> uses that.
1907
1908The C<HINT_FEATURE_MASK> macro is defined in F<perl.h> along with other
1909hints. Other macros for setting and testing features and bundles are in
1910the new F<feature.h>. C<FEATURE_IS_ENABLED> (which has moved to
1911F<feature.h>) is no longer used throughout the codebase, but more specific
1912macros, e.g., C<FEATURE_SAY_IS_ENABLED>, that are defined in F<feature.h>.
1913
1914=item *
1915
1916F<lib/feature.pm> is now a generated file, created by the new
1917F<regen/feature.pl> script, which also generates F<feature.h>.
1918
1919=item *
1920
1921Tied arrays are now always C<AvREAL>. If C<@_> or C<DB::args> is tied, it
1922is reified first, to make sure this is always the case.
1923
1924=item *
1925
1926Two new functions C<utf8_to_uvchr_buf()> and C<utf8_to_uvuni_buf()> have
1927been added. These are the same as C<utf8_to_uvchr> and
1928C<utf8_to_uvuni> (which are now deprecated), but take an extra parameter
1929that is used to guard against reading beyond the end of the input
1930string.
1931See L<perlapi/utf8_to_uvchr_buf> and L<perlapi/utf8_to_uvuni_buf>.
1932
1933=item *
1934
1935The regular expression engine now does TRIE case insensitive matches
1936under Unicode. This may change the output of C<< use re 'debug'; >>,
1937and will speed up various things.
1938
44d82778
FC
1939=item *
1940
1941There is a new C<wrap_op_checker()> function, which provides a thread-safe
1942alternative to writing to C<PL_check> directly.
1943
30682cc3
RS
1944=back
1945
1946=head1 Selected Bug Fixes
1947
581af396 1948=head2 Array and hash
77649ca9 1949
581af396 1950=over
1d1e229c
FC
1951
1952=item *
1953
581af396
RS
1954A bug has been fixed that would cause a "Use of freed value in iteration"
1955error if the next two hash elements that would be iterated over are
1956deleted [perl #85026]. (5.14.1)
77649ca9
RS
1957
1958=item *
1959
581af396
RS
1960Deleting the current hash iterator (the hash element that would be returend
1961by the next call to C<each>) in void context used not to free it
1962[perl #85026].
a14d7d4a
RS
1963
1964=item *
1965
581af396
RS
1966Deletion of methods via C<delete $Class::{method}> syntax used to update
1967method caches if called in void context, but not scalar or list context.
a14d7d4a
RS
1968
1969=item *
1970
581af396
RS
1971When hash elements are deleted in void context, the internal hash entry is
1972now freed before the value is freed, to prevent destructors called by that
1973latter freeing from seeing the hash in an inconsistent state. It was
1974possible to cause double-frees if the destructor freed the hash itself
1975[perl #100340].
a14d7d4a
RS
1976
1977=item *
1978
581af396
RS
1979A C<keys> optimisation in Perl 5.12.0 to make it faster on empty hashes
1980caused C<each> not to reset the iterator if called after the last element
1981was deleted.
a14d7d4a
RS
1982
1983=item *
1984
581af396 1985Freeing deeply nested hashes no longer crashes [perl #44225].
a14d7d4a 1986
77649ca9
RS
1987=item *
1988
581af396
RS
1989It is possible from XS code to create hashes with elements that have no
1990values. The hash element and slice operators used to crash
1991when handling these in lvalue context. They now
1992produce a "Modification of non-creatable hash value attempted" error
1993message.
77649ca9 1994
b77d6b93
FC
1995=item *
1996
581af396
RS
1997If list assignment to a hash or array triggered destructors that freed the
1998hash or array itself, a crash would ensue. This is no longer the case
1999[perl #107440].
b77d6b93
FC
2000
2001=item *
2002
581af396
RS
2003It used to be possible to free the typeglob of a localised array or hash
2004(e.g., C<local @{"x"}; delete $::{x}>), resulting in a crash on scope exit.
b77d6b93
FC
2005
2006=item *
2007
581af396
RS
2008Some core bugs affecting L<Hash::Util> have been fixed: locking a hash
2009element that is a glob copy no longer causes subsequent assignment to it to
2010corrupt the glob, and unlocking a hash element that holds a copy-on-write
2011scalar no longer causes modifications to that scalar to modify other
2012scalars that were sharing the same string buffer.
b77d6b93 2013
581af396 2014=back
b77d6b93 2015
581af396 2016=head2 C API fixes
b77d6b93 2017
581af396 2018=over
b77d6b93
FC
2019
2020=item *
2021
581af396
RS
2022The C<newHVhv> XS function now works on tied hashes, instead of crashing or
2023returning an empty hash.
b77d6b93
FC
2024
2025=item *
2026
581af396
RS
2027The C<SvIsCOW> C macro now returns false for read-only copies of typeglobs,
2028such as those created by:
b77d6b93 2029
581af396
RS
2030 $hash{elem} = *foo;
2031 Hash::Util::lock_value %hash, 'elem';
b77d6b93 2032
581af396 2033It used to return true.
b77d6b93
FC
2034
2035=item *
2036
581af396
RS
2037The C<SvPVutf8> C function no longer tries to modify its argument,
2038resulting in errors [perl #108994].
b77d6b93
FC
2039
2040=item *
2041
581af396 2042C<SvPVutf8> now works properly with magical variables.
b77d6b93
FC
2043
2044=item *
2045
581af396 2046C<SvPVbyte> now works properly non-PVs.
b77d6b93 2047
081d8988
FC
2048=item *
2049
581af396
RS
2050When presented with malformed UTF-8 input, the XS-callable functions
2051C<is_utf8_string()>, C<is_utf8_string_loc()>, and
2052C<is_utf8_string_loclen()> could read beyond the end of the input
2053string by up to 12 bytes. This no longer happens. [perl #32080].
2054However, currently, C<is_utf8_char()> still has this defect, see
2055L</is_utf8_char()> above.
081d8988
FC
2056
2057=item *
2058
581af396
RS
2059The C-level C<pregcomp> function could become confused as to whether the
2060pattern was in UTF8 if the pattern was an overloaded, tied, or otherwise
2061magical scalar [perl #101940].
1c6fad2d 2062
581af396 2063=back
1c6fad2d 2064
581af396 2065=head2 Compile-time hints
e87b7063 2066
581af396 2067=over
e87b7063
RS
2068
2069=item *
2070
581af396
RS
2071Tying C<%^H> no longer causes perl to crash or ignore the contents of
2072C<%^H> when entering a compilation scope [perl #106282].
a14d7d4a
RS
2073
2074=item *
2075
581af396
RS
2076C<eval $string> and C<require> used not to
2077localise C<%^H> during compilation if it
2078was empty at the time the C<eval> call itself was compiled. This could
2079lead to scary side effects, like C<use re "/m"> enabling other flags that
2080the surrounding code was trying to enable for its caller [perl #68750].
a14d7d4a
RS
2081
2082=item *
2083
581af396
RS
2084C<eval $string> and C<require> no longer localise hints (C<$^H> and C<%^H>)
2085at run time, but only during compilation of the $string or required file.
2086This makes C<BEGIN { $^H{foo}=7 }> equivalent to
2087C<BEGIN { eval '$^H{foo}=7' }> [perl #70151].
a14d7d4a 2088
8dd333f3
FC
2089=item *
2090
581af396
RS
2091Creating a BEGIN block from XS code (via C<newXS> or C<newATTRSUB>) would,
2092on completion, make the hints of the current compiling code the current
2093hints. This could cause warnings to occur in a non-warning scope.
8dd333f3 2094
a14d7d4a
RS
2095=back
2096
2097=head2 Copy-on-write scalars
2098
5290772f
FC
2099Copy-on-write or shared hash key scalars
2100were introduced in 5.8.0, but most Perl code
a14d7d4a
RS
2101did not encounter them (they were used mostly internally). Perl
21025.10.0 extended them, such that assigning C<__PACKAGE__> or a
2103hash key to a scalar would make it copy-on-write. Several parts
2104of Perl were not updated to account for them, but have now been fixed.
2105
2106=over
2107
2108=item *
2109
2110C<utf8::decode> had a nasty bug that would modify copy-on-write scalars'
2111string buffers in place (i.e., skipping the copy). This could result in
2112hashes having two elements with the same key [perl #91834].
2113
2114=item *
2115
2116Lvalue subroutines were not allowing COW scalars to be returned. This was
2117fixed for lvalue scalar context in Perl 5.12.3 and 5.14.0, but list context
2118was not fixed until this release.
2119
2120=item *
2121
2122Elements of restricted hashes (see the L<fields> pragma) containing
2123copy-on-write values couldn't be deleted, nor could such hashes be cleared
2124(C<%hash = ()>).
2125
2126=item *
2127
2128Localising a tied variable used to make it read-only if it contained a
2129copy-on-write string.
2130
2131=item *
2132
5290772f
FC
2133Assigning a copy-on-write string to a stash
2134element no longer causes a double free. Regardless of this change, the
2135results of such assignments are still undefined.
2136
2137=item *
2138
2139Assigning a copy-on-write string to a tied variable no longer stops that
2140variable from being tied if it happens to be a PVMG or PVLV internally.
2141
2142=item *
2143
2144Doing a substitution on a tied variable returning a copy-on-write
2145scalar used to cause an assertion failure or an "Attempt to free
2146nonexistent shared string" warning.
2147
2148=item *
2149
2150This one is a regression from 5.12: In 5.14.0, the bitwise assignment
2151operators C<|=>, C<^=> and C<&=> started leaving the left-hand side
2152undefined if it happened to be a copy-on-write string [perl #108480].
2153
2154=item *
2155
a14d7d4a
RS
2156L<Storable>, L<Devel::Peek> and L<PerlIO::scalar> had similar problems.
2157See L</Updated Modules and Pragmata>, above.
2158
2159=back
2160
581af396 2161=head2 The debugger
a14d7d4a 2162
a14d7d4a
RS
2163=over
2164
2165=item *
2166
581af396
RS
2167F<dumpvar.pl>, and consequently the C<x> command in the debugger, have been
2168fixed to handle objects blessed into classes whose names contain "=". The
2169contents of such objects used not to be dumped [perl #101814].
a14d7d4a 2170
a14d7d4a
RS
2171=item *
2172
581af396
RS
2173The "R" command for restarting a debugger session has been fixed to work on
2174Windows, or any other system lacking a C<POSIX::_SC_OPEN_MAX> constant
2175[perl #87740].
a14d7d4a
RS
2176
2177=item *
2178
581af396
RS
2179The C<#line 42 foo> directive used not to update the arrays of lines used
2180by the debugger if it occurred in a string eval. This was partially fixed
2181in 5.14, but it only worked for a single C<#line 42 foo> in each eval. Now
2182it works for multiple.
a14d7d4a
RS
2183
2184=item *
2185
581af396
RS
2186When subroutine calls are intercepted by the debugger, the name of the
2187subroutine or a reference to it is stored in C<$DB::sub>, for the debugger
2188to access. In some cases (such as C<$foo = *bar; undef *bar; &$foo>)
2189C<$DB::sub> would be set to a name that could not be used to find the
2190subroutine, and so the debugger's attempt to call it would fail. Now the
2191check to see whether a reference is needed is more robust, so those
2192problems should not happen anymore [rt.cpan.org #69862].
a14d7d4a
RS
2193
2194=item *
2195
581af396
RS
2196Every subroutine has a filename associated with it that the debugger uses.
2197The one associated with constant subroutines used to be misallocated when
2198cloned under threads. Consequently, debugging threaded applications could
2199result in memory corruption [perl #96126].
0fe29a63 2200
581af396 2201=back
a14d7d4a 2202
581af396 2203=head2 Dereferencing operators
a14d7d4a 2204
581af396 2205=over
a14d7d4a
RS
2206
2207=item *
2208
581af396
RS
2209C<defined(${"..."})>, C<defined(*{"..."})>, etc., used to
2210return true for most, but not all built-in variables, if
2211they had not been used yet. This bug affected C<${^GLOBAL_PHASE}> and
2212C<${^UTF8CACHE}>, among others. It also used to return false if the
2213package name was given as well (C<${"::!"}>) [perl #97978, #97492].
a14d7d4a 2214
77649ca9
RS
2215=item *
2216
581af396
RS
2217Perl 5.10.0 introduced a similar bug: C<defined(*{"foo"})> where "foo"
2218represents the name of a built-in global variable used to return false if
2219the variable had never been used before, but only on the I<first> call.
2220This, too, has been fixed.
77649ca9 2221
4ad239c3
FC
2222=item *
2223
581af396
RS
2224Since 5.6.0, C<*{ ... }> has been inconsistent in how it treats undefined
2225values. It would die in strict mode or lvalue context for most undefined
2226values, but would be treated as the empty string (with a warning) for the
2227specific scalar return by C<undef()> (C<&PL_sv_undef> internally). This
2228has been corrected. C<undef()> is now treated like other undefined
2229scalars, as in Perl 5.005.
4ad239c3 2230
581af396 2231=back
4ad239c3 2232
581af396 2233=head2 Filehandle, last-accessed
4ad239c3 2234
581af396
RS
2235Perl has an internal variable that stores the last filehandle to be
2236accessed. It is used by C<$.> and by C<tell> and C<eof> without
2237arguments.
4ad239c3 2238
581af396 2239=over
4ad239c3
FC
2240
2241=item *
2242
581af396
RS
2243It used to be possible to set this internal variable to a glob copy and
2244then modify that glob copy to be something other than a glob, and still
2245have the last-accessed filehandle associated with the variable after
2246assigning a glob to it again:
0fe29a63 2247
581af396
RS
2248 my $foo = *STDOUT; # $foo is a glob copy
2249 <$foo>; # $foo is now the last-accessed handle
2250 $foo = 3; # no longer a glob
2251 $foo = *STDERR; # still the last-accessed handle
0fe29a63 2252
581af396
RS
2253Now the C<$foo = 3> assignment unsets that internal variable, so there
2254is no last-accessed filehandle, just as if C<< <$foo> >> had never
2255happened.
4ad239c3 2256
581af396
RS
2257This also prevents some unrelated handle from becoming the last-accessed
2258handle if $foo falls out of scope and the same internal SV gets used for
2259another handle [perl #97988].
4ad239c3
FC
2260
2261=item *
2262
581af396
RS
2263A regression in 5.14 caused these statements not to set that internal
2264variable:
2265
2266 my $fh = *STDOUT;
2267 tell $fh;
2268 eof $fh;
2269 seek $fh, 0,0;
2270 tell *$fh;
2271 eof *$fh;
2272 seek *$fh, 0,0;
2273 readline *$fh;
2274
2275This is now fixed, but C<tell *{ *$fh }> still has the problem, and it
2276is not clear how to fix it [perl #106536].
4ad239c3 2277
a14d7d4a
RS
2278=back
2279
581af396
RS
2280=head2 Filetests and C<stat>
2281
2282The term "filetests" refers to the operators that consist of a hyphen
2283followed by a single letter: C<-r>, C<-x>, C<-M>, etc. The term "stacked"
2284when applied to filetests means followed by another filetest operator
2285sharing the same operand, as in C<-r -x -w $fooo>.
85adda6e
FC
2286
2287=over
2288
2289=item *
2290
581af396
RS
2291C<stat> produces more consistent warnings. It no longer warns for "_"
2292[perl #71002] and no longer skips the warning at times for other unopened
2293handles. It no longer warns about an unopened handle when the operating
2294system's C<fstat> function fails.
85adda6e
FC
2295
2296=item *
2297
581af396
RS
2298C<stat> would sometimes return negative numbers for large inode numbers,
2299because it was using the wrong internal C type. [perl #84590]
85adda6e
FC
2300
2301=item *
2302
581af396
RS
2303C<lstat> is documented to fall back to C<stat> (with a warning) when given
2304a filehandle. When passed an IO reference, it was actually doing the
2305equivalent of S<C<stat _>> and ignoring the handle.
9320cecf
FC
2306
2307=item *
2308
581af396
RS
2309C<-T _> with no preceding C<stat> used to produce a
2310confusing "uninitialized" warning, even though there
2311is no visible uninitialized value to speak of.
85adda6e 2312
581af396 2313=item *
a14d7d4a 2314
581af396
RS
2315C<-T>, C<-B>, C<-l> and C<-t> now work
2316when stacked with other filetest operators
2317[perl #77388].
a14d7d4a
RS
2318
2319=item *
2320
581af396
RS
2321In 5.14.0, filetest ops (C<-r>, C<-x>, etc.) started calling FETCH on a
2322tied argument belonging to the previous argument to a list operator, if
2323called with a bareword argument or no argument at all. This has been
2324fixed, so C<push @foo, $tied, -r> no longer calls FETCH on C<$tied>.
a14d7d4a
RS
2325
2326=item *
2327
581af396
RS
2328In Perl 5.6, C<-l> followed by anything other than a bareword would treat
2329its argument as a file name. That was changed in 5.8 for glob references
2330(C<\*foo>), but not for globs themselves (C<*foo>). C<-l> started
2331returning C<undef> for glob references without setting the last
2332stat buffer that the "_" handle uses, but only if warnings
2333were turned on. With warnings off, it was the same as 5.6.
2334In other words, it was simply buggy and inconsistent. Now the 5.6
2335behaviour has been restored.
3949715f
FC
2336
2337=item *
2338
581af396
RS
2339C<-l> followed by a bareword no longer "eats" the previous argument to
2340the list operator in whose argument list it resides. Hence,
2341C<print "bar", -l foo> now actually prints "bar", because C<-l>
2342on longer eats it.
3949715f
FC
2343
2344=item *
2345
581af396
RS
2346Perl keeps several internal variables to keep track of the last stat
2347buffer, from which file(handle) it originated, what type it was, and
2348whether the last stat succeeded.
2349
2350There were various cases where these could get out of synch, resulting in
2351inconsistent or erratic behaviour in edge cases (every mention of C<-T>
2352applies to C<-B> as well):
2353
2354=over
3949715f
FC
2355
2356=item *
2357
581af396
RS
2358C<-T I<HANDLE>>, even though it does a C<stat>, was not resetting the last
2359stat type, so an C<lstat _> following it would merrily return the wrong
2360results. Also, it was not setting the success status.
3949715f 2361
cbd5afc5
FC
2362=item *
2363
581af396
RS
2364Freeing the handle last used by C<stat> or a filetest could result in
2365S<C<-T _>> using an unrelated handle.
3949715f
FC
2366
2367=item *
2368
581af396
RS
2369C<stat> with an IO reference would not reset the stat type or record the
2370filehandle for S<C<-T _>> to use.
cbd5afc5
FC
2371
2372=item *
2373
581af396
RS
2374Fatal warnings could cause the stat buffer not to be reset
2375for a filetest operator on an unopened filehandle or C<-l> on any handle.
2376Fatal warnings also stopped C<-T> from setting C<$!>.
3949715f
FC
2377
2378=item *
2379
581af396
RS
2380When the last stat was on an unreadable file, C<-T _> is supposed to
2381return C<undef>, leaving the last stat buffer unchanged. But it was
2382setting the stat type, causing C<lstat _> to stop working.
3949715f 2383
b7967cca
FC
2384=item *
2385
581af396
RS
2386C<-T I<FILENAME>> was not resetting the internal stat buffers for
2387unreadable files.
b7967cca 2388
a14d7d4a
RS
2389=back
2390
581af396
RS
2391These have all been fixed.
2392
2393=back
2394
2395=head2 Formats
12fab0b9
FC
2396
2397=over
2398
2399=item *
2400
581af396
RS
2401A number of edge cases have been fixed with formats and C<formline>;
2402in particular, where the format itself is potentially variable (such as
2403with ties and overloading), and where the format and data differ in their
2404encoding. In both these cases, it used to possible for the output to be
2405corrupted [perl #91032].
12fab0b9
FC
2406
2407=item *
2408
581af396
RS
2409C<formline> no longer converts its argument into a string in-place. So
2410passing a reference to C<formline> no longer destroys the reference
2411[perl #79532].
12fab0b9
FC
2412
2413=item *
2414
581af396
RS
2415Assignment to C<$^A> (the format output accumulator) now recalculates
2416the number of lines output.
2417
2418=back
2419
2420=head2 C<given> and C<when>
2421
2422=over
12fab0b9
FC
2423
2424=item *
2425
581af396
RS
2426C<given> was not scoping its implicit $_ properly, resulting in memory
2427leaks or "Variable is not available" warnings [perl #94682].
12fab0b9 2428
581af396 2429=item *
12fab0b9 2430
581af396
RS
2431C<given> was not calling set-magic on the implicit lexical C<$_> that it
2432uses. This meant, for example, that C<pos> would be remembered from one
2433execution of the same C<given> block to the next, even if the input were a
2434different variable [perl #84526].
021c503d 2435
581af396
RS
2436=item *
2437
2438C<when> blocks are now capable of returning variables declared inside the
2439enclosing C<given> block [perl #93548].
2440
2441=back
2442
2443=head2 The C<glob> operator
021c503d
RS
2444
2445=over
2446
2447=item *
2448
581af396
RS
2449On OSes other than VMS, Perl's C<glob> operator (and the C<< <...> >> form)
2450use L<File::Glob> underneath. L<File::Glob> splits the pattern into words,
2451before feeding each word to its C<bsd_glob> function.
2452
2453There were several inconsistencies in the way the split was done. Now
2454quotation marks (' and ") are always treated as shell-style word delimiters
2455(that allow whitespace as part of a word) and backslashes are always
2456preserved, unless they exist to escape quotation marks. Before, those
2457would only sometimes be the case, depending on whether the pattern
2458contained whitespace. Also, escaped whitespace at the end of the pattern
2459is no longer stripped [perl #40470].
021c503d
RS
2460
2461=item *
2462
581af396
RS
2463C<CORE::glob> now works as a way to call the default globbing function. It
2464used to respect overrides, despite the C<CORE::> prefix.
021c503d
RS
2465
2466=item *
2467
581af396
RS
2468Under miniperl (used to configure modules when perl itself is built),
2469C<glob> now clears %ENV before calling csh, since the latter croaks on some
2470systems if it does not like the contents of the LS_COLORS enviroment
2471variable [perl #98662].
2472
2473=back
2474
2475=head2 Lvalue subroutines
2476
2477=over
021c503d
RS
2478
2479=item *
2480
581af396
RS
2481Explicit return now returns the actual argument passed to return, instead
2482of copying it [perl #72724, #72706].
021c503d
RS
2483
2484=item *
2485
581af396
RS
2486Lvalue subroutines used to enforce lvalue syntax (i.e., whatever can go on
2487the left-hand side of C<=>) for the last statement and the arguments to
2488return. Since lvalue subroutines are not always called in lvalue context,
2489this restriction has been lifted.
021c503d
RS
2490
2491=item *
2492
581af396
RS
2493Lvalue subroutines are less restrictive as to what values can be returned.
2494It used to croak on values returned by C<shift> and C<delete> and from
2495other subroutines, but no longer does so [perl #71172].
021c503d 2496
581af396 2497=item *
021c503d 2498
581af396
RS
2499Empty lvalue subroutines (C<sub :lvalue {}>) used to return C<@_> in list
2500context. In fact, all subroutines used to, but regular subs were fixed in
2501Perl 5.8.2. Now lvalue subroutines have been likewise fixed.
021c503d 2502
581af396 2503=item *
200b6340 2504
581af396
RS
2505Autovivification now works on values returned from lvalue subroutines
2506[perl #7946], as does returning C<keys> in lvalue context.
200b6340 2507
581af396
RS
2508=item *
2509
2510Lvalue subroutines used to copy their return values in rvalue context. Not
2511only was this a waste of CPU cycles, but it also caused bugs. A C<($)>
2512prototype would cause an lvalue sub to copy its return value [perl #51408],
2513and C<while(lvalue_sub() =~ m/.../g) { ... }> would loop endlessly
2514[perl #78680].
200b6340
FC
2515
2516=item *
2517
581af396
RS
2518When called in potential lvalue context
2519(e.g., subroutine arguments or a list
2520passed to C<for>), lvalue subroutines used to copy
2521any read-only value that was returned. E.g., C< sub :lvalue { $] } >
2522would not return C<$]>, but a copy of it.
5d27fa85
FC
2523
2524=item *
2525
581af396
RS
2526When called in potential lvalue context, an lvalue subroutine returning
2527arrays or hashes used to bind the arrays or hashes to scalar variables,
2528resulting in bugs. This was fixed in 5.14.0 if an array were the first
2529thing returned from the subroutine (but not for C<$scalar, @array> or
2530hashes being returned). Now a more general fix has been applied
2531[perl #23790].
5d27fa85
FC
2532
2533=item *
2534
581af396
RS
2535Method calls whose arguments were all surrounded with C<my()> or C<our()>
2536(as in C<< $object->method(my($a,$b)) >>) used to force lvalue context on
2537the subroutine. This would prevent lvalue methods from returning certain
2538values.
200b6340
FC
2539
2540=item *
2541
581af396
RS
2542Lvalue sub calls that are not determined to be such at compile time
2543(C<&$name> or &{"name"}) are no longer exempt from strict refs if they
2544occur in the last statement of an lvalue subroutine [perl #102486].
200b6340
FC
2545
2546=item *
2547
581af396
RS
2548Sub calls whose subs are not visible at compile time, if
2549they occurred in the last statement of an lvalue subroutine,
2550would reject non-lvalue subroutines and die with "Can't modify non-lvalue
2551subroutine call" [perl #102486].
2552
2553Non-lvalue sub calls whose subs I<are> visible at compile time exhibited
2554the opposite bug. If the call occurred in the last statement of an lvalue
2555subroutine, there would be no error when the lvalue sub was called in
2556lvalue context. Perl would blindly assign to the temporary value returned
2557by the non-lvalue subroutine.
200b6340
FC
2558
2559=item *
2560
581af396
RS
2561C<AUTOLOAD> routines used to take precedence over the actual sub being
2562called (i.e., when autoloading wasn't needed), for sub calls in lvalue or
2563potential lvalue context, if the subroutine was not visible at compile
2564time.
5d27fa85
FC
2565
2566=item *
2567
581af396
RS
2568Applying the C<:lvalue> attribute to an XSUB or to an aliased subroutine
2569stub with C<< sub foo :lvalue; >> syntax stopped working in Perl 5.12.
2570This has been fixed.
5d27fa85
FC
2571
2572=item *
2573
581af396
RS
2574Applying the :lvalue attribute to subroutine that is already defined does
2575not work properly, as the attribute changes the way the sub is compiled.
2576Hence, Perl 5.12 began warning when an attempt is made to apply the
2577attribute to an already defined sub. In such cases, the attribute is
2578discarded.
2579
2580But the change in 5.12 missed the case where custom attributes are also
2581present: that case still silently and ineffectively applied the attribute.
2582That omission has now been corrected. C<sub foo :lvalue :Whatever> (when
2583C<foo> is already defined) now warns about the :lvalue attribute, and does
2584not apply it.
e45e6487
FC
2585
2586=item *
2587
581af396
RS
2588A bug affecting lvalue context propagation through nested lvalue subroutine
2589calls has been fixed. Previously, returning a value in nested rvalue
2590context would be treated as lvalue context by the inner subroutine call,
2591resulting in some values (such as read-only values) being rejected.
200b6340 2592
581af396
RS
2593=back
2594
2595=head2 Overloading
200b6340
FC
2596
2597=over
2598
2599=item *
2600
581af396
RS
2601Arithmetic assignment (C<$left += $right>) involving overloaded objects
2602that rely on the 'nomethod' override no longer segfault when the left
2603operand is not overloaded.
200b6340
FC
2604
2605=item *
2606
581af396
RS
2607Errors that occur when methods cannot be found during overloading now
2608mention the correct package name, as they did in 5.8.x, instead of
2609erroneously mentioning the "overload" package, as they have since 5.10.0.
200b6340
FC
2610
2611=item *
2612
581af396 2613Undefining C<%overload::> no longer causes a crash.
200b6340 2614
581af396 2615=back
200b6340 2616
581af396
RS
2617=head2 Prototypes of built-in keywords
2618
2619=over
200b6340
FC
2620
2621=item *
2622
581af396
RS
2623The C<prototype> function no longer dies for the C<__FILE__>, C<__LINE__>
2624and C<__PACKAGE__> directives. It now returns an empty-string prototype
2625for them, because they are syntactically indistinguishable from nullary
2626functions like C<time>.
200b6340
FC
2627
2628=item *
2629
581af396
RS
2630C<prototype> now returns C<undef> for all overridable infix operators,
2631such as C<eq>, which are not callable in any way resembling functions.
2632It used to return incorrect prototypes for some and die for others
2633[perl #94984].
200b6340 2634
581af396 2635=item *
200b6340 2636
581af396
RS
2637The prototypes of several built-in functions--C<getprotobynumber>, C<lock>,
2638C<not> and C<select>--have been corrected, or at least are now closer to
2639reality than before.
200b6340 2640
200b6340
FC
2641=back
2642
581af396 2643=head2 Regular expressions
2f2cde2e 2644
581af396
RS
2645=for comment Is it possible to merge some of these items?
2646
2647=over 4
2f2cde2e
FC
2648
2649=item *
2650
581af396
RS
2651C</[[:ascii:]]/> and C</[[:blank:]]/> now use locale rules under
2652C<use locale> when the platform supports that. Previously, they used
2653the platform's native character set.
2f2cde2e
FC
2654
2655=item *
2656
581af396
RS
2657C<m/[[:ascii:]]/i> and C</\p{ASCII}/i> now match identically (when not
2658under a differing locale). This fixes a regression introduced in 5.14
2659in which the first expression could match characters outside of ASCII,
2660such as the KELVIN SIGN.
2f2cde2e
FC
2661
2662=item *
2663
581af396
RS
2664C</.*/g> would sometimes refuse to match at the end of a string that ends
2665with "\n". This has been fixed [perl #109206].
2f2cde2e
FC
2666
2667=item *
2668
581af396
RS
2669Starting with 5.12.0, Perl used to get its internal bookkeeping muddled up
2670after assigning C<${ qr// }> to a hash element and locking it with
2671L<Hash::Util>. This could result in double frees, crashes or erratic
2672behaviour.
2f2cde2e
FC
2673
2674=item *
2675
581af396
RS
2676The new (in 5.14.0) regular expression modifier C</a> when repeated like
2677C</aa> forbids the characters outside the ASCII range that match
2678characters inside that range from matching under C</i>. This did not
2679work under some circumstances, all involving alternation, such as:
2f2cde2e 2680
581af396 2681 "\N{KELVIN SIGN}" =~ /k|foo/iaa;
977d6e9a 2682
581af396 2683succeeded inappropriately. This is now fixed.
977d6e9a
FC
2684
2685=item *
2686
581af396
RS
26875.14.0 introduced some memory leaks in regular expression character
2688classes such as C<[\w\s]>, which have now been fixed. (5.14.1)
977d6e9a
FC
2689
2690=item *
2691
581af396
RS
2692An edge case in regular expression matching could potentially loop.
2693This happened only under C</i> in bracketed character classes that have
2694characters with multi-character folds, and the target string to match
2695against includes the first portion of the fold, followed by another
2696character that has a multi-character fold that begins with the remaining
2697portion of the fold, plus some more.
977d6e9a 2698
581af396 2699 "s\N{U+DF}" =~ /[\x{DF}foo]/i
977d6e9a 2700
581af396 2701is one such case. C<\xDF> folds to C<"ss">. (5.14.1)
977d6e9a
FC
2702
2703=item *
2704
581af396
RS
2705A few characters in regular expression pattern matches did not
2706match correctly in some circumstances, all involving C</i>. The
2707affected characters are:
2708COMBINING GREEK YPOGEGRAMMENI,
2709GREEK CAPITAL LETTER IOTA,
2710GREEK CAPITAL LETTER UPSILON,
2711GREEK PROSGEGRAMMENI,
2712GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA,
2713GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS,
2714GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA,
2715GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS,
2716LATIN SMALL LETTER LONG S,
2717LATIN SMALL LIGATURE LONG S T,
2718and
2719LATIN SMALL LIGATURE ST.
841ee14b
RS
2720
2721=item *
2722
581af396
RS
2723A memory leak regression in regular expression compilation
2724under threading has been fixed.
977d6e9a
FC
2725
2726=item *
2727
581af396
RS
2728A regression introduced in 5.13.6 has
2729been fixed. This involved an inverted
2730bracketed character class in a regular expression that consisted solely
2731of a Unicode property. That property wasn't getting inverted outside the
2732Latin1 range.
977d6e9a
FC
2733
2734=item *
2735
581af396 2736Three problematic Unicode characters now work better in regex pattern matching under C</i>
977d6e9a 2737
581af396
RS
2738In the past, three Unicode characters:
2739LATIN SMALL LETTER SHARP S,
2740GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS,
2741and
2742GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS,
2743along with the sequences that they fold to
2744(including "ss" in the case of LATIN SMALL LETTER SHARP S),
2745did not properly match under C</i>. 5.14.0 fixed some of these cases,
2746but introduced others, including a panic when one of the characters or
2747sequences was used in the C<(?(DEFINE)> regular expression predicate.
2748The known bugs that were introduced in 5.14 have now been fixed; as well
2749as some other edge cases that have never worked until now. All these
2750involve using the characters and sequences outside bracketed character
2751classes under C</i>. This closes [perl #98546].
977d6e9a 2752
581af396
RS
2753There remain known problems when using certain characters with
2754multi-character folds inside bracketed character classes, including such
2755constructs as C<qr/[\N{LATIN SMALL LETTER SHARP}a-z]/i>. These
2756remaining bugs are addressed in [perl #89774].
977d6e9a
FC
2757
2758=item *
2759
581af396
RS
2760RT #78266: The regex engine has been leaking memory when accessing
2761named captures that weren't matched as part of a regex ever since 5.10
2762when they were introduced, e.g. this would consume over a hundred MB of
2763memory:
977d6e9a 2764
581af396
RS
2765 for (1..10_000_000) {
2766 if ("foo" =~ /(foo|(?<capture>bar))?/) {
2767 my $capture = $+{capture}
2768 }
2769 }
2770 system "ps -o rss $$"'
977d6e9a
FC
2771
2772=item *
2773
581af396
RS
2774In 5.14, C</[[:lower:]]/i> and C</[[:upper:]]/i> no longer matched the
2775opposite case. This has been fixed [perl #101970].
977d6e9a
FC
2776
2777=item *
2778
581af396
RS
2779A regular expression match with an overloaded object on the right-hand side
2780would in some cases stringify the object too many times.
977d6e9a
FC
2781
2782=item *
2783
581af396
RS
2784A regression has been fixed that was introduced in 5.14, in C</i>
2785regular expression matching, in which a match improperly fails if the
2786pattern is in UTF-8, the target string is not, and a Latin-1 character
2787precedes a character in the string that should match the pattern.
2788[perl #101710]
977d6e9a
FC
2789
2790=item *
2791
581af396
RS
2792In case-insensitive regular expression pattern matching, no longer on
2793UTF-8 encoded strings does the scan for the start of match only look at
2794the first possible position. This caused matches such as
2795C<"f\x{FB00}" =~ /ff/i> to fail.
977d6e9a
FC
2796
2797=item *
2798
581af396
RS
2799The regexp optimiser no longer crashes on debugging builds when merging
2800fixed-string nodes with inconvenient contents.
977d6e9a
FC
2801
2802=item *
2803
581af396
RS
2804A panic involving the combination of the regular expression modifiers
2805C</aa> and the C<\b> escape sequence introduced in 5.14.0 has been
2806fixed [perl #95964].
977d6e9a
FC
2807
2808=item *
2809
581af396
RS
2810The combination of the regular expression modifiers C</aa> and the C<\b>
2811and C<\B> escape sequences did not work properly on UTF-8 encoded
2812strings. All non-ASCII characters under C</aa> should be treated as
2813non-word characters, but what was happening was that Unicode rules were
2814used to determine wordness/non-wordness for non-ASCII characters. This
2815is now fixed [perl #95968].
977d6e9a
FC
2816
2817=item *
2818
581af396 2819C<< (?foo: ...) >> no longer loses passed in character set.
977d6e9a
FC
2820
2821=item *
2822
581af396
RS
2823The trie optimisation used to have problems with alternations containing
2824an empty C<(?:)>, causing C<< "x" =~ /\A(?>(?:(?:)A|B|C?x))\z/ >> not to
2825match, whereas it should [perl #111842].
977d6e9a
FC
2826
2827=item *
2828
581af396
RS
2829Use of lexical (C<my>) variables in code blocks embedded in regular
2830expressions will no longer result in memory corruption or crashes.
2831
2832Nevertheless, these code blocks are still experimental, as there are still
2833problems with the wrong variables being closed over (in loops for instance)
2834and with abnormal exiting (e.g., C<die>) causing memory corruption.
977d6e9a
FC
2835
2836=item *
2837
581af396
RS
2838The C<\h>, C<\H>, C<\v> and C<\V> regular expression metacharacters used to
2839cause a panic error message when attempting to match at the end of the
2840string [perl #96354].
977d6e9a
FC
2841
2842=item *
2843
581af396
RS
2844The abbreviations for four C1 control characters C<MW> C<PM>, C<RI>, and
2845C<ST> were previously unrecognized by C<\N{}>, vianame(), and
2846string_vianame().
977d6e9a
FC
2847
2848=item *
2849
581af396
RS
2850Mentioning a variable named "&" other than C<$&> (i.e., C<@&> or C<%&>) no
2851longer stops C<$&> from working. The same applies to variables named "'"
2852and "`" [perl #24237].
977d6e9a
FC
2853
2854=item *
2855
581af396
RS
2856Creating a C<UNIVERSAL::AUTOLOAD> sub no longer stops C<%+>, C<%-> and
2857C<%!> from working some of the time [perl #105024].
977d6e9a
FC
2858
2859=back
2860
581af396 2861=head2 Smartmatching
a14d7d4a
RS
2862
2863=over
2864
021c503d
RS
2865=item *
2866
581af396
RS
2867C<~~> now correctly handles the precedence of Any~~Object, and is not tricked
2868by an overloaded object on the left-hand side.
b81fe5e9
FC
2869
2870=item *
2871
581af396
RS
2872In Perl 5.14.0, C<$tainted ~~ @array> stopped working properly. Sometimes
2873it would erroneously fail (when C<$tainted> contained a string that occurs
2874in the array I<after> the first element) or erroneously succeed (when
2875C<undef> occurred after the first element) [perl #93590].
b81fe5e9
FC
2876
2877=back
2878
581af396 2879=head2 The C<sort> operator
021c503d 2880
edc1ae43
FC
2881=over
2882
2883=item *
2884
581af396
RS
2885C<sort> was not treating C<sub {}> and C<sub {()}> as equivalent when
2886such a sub was provided as the comparison routine. It used to croak on
2887C<sub {()}>.
021c503d 2888
581af396 2889=item *
021c503d 2890
581af396
RS
2891C<sort> now works once more with custom sort routines that are XSUBs. It
2892stopped working in 5.10.0.
021c503d 2893
581af396
RS
2894=item *
2895
2896C<sort> with a constant for a custom sort routine, although it produces
2897unsorted results, no longer crashes. It started crashing in 5.10.0.
edc1ae43
FC
2898
2899=item *
2900
581af396
RS
2901Warnings emitted by C<sort> when a custom comparison routine returns a
2902non-numeric value now contain "in sort" and show the line number of the
2903C<sort> operator, rather than the last line of the comparison routine. The
2904warnings also occur now only if warnings are enabled in the scope where
2905C<sort> occurs. Previously the warnings would occur if enabled in the
2906comparison routine's scope.
edc1ae43 2907
581af396 2908=item *
edc1ae43 2909
581af396
RS
2910C<< sort { $a <=> $b } >>, which is optimised internally, now produces
2911"uninitialized" warnings for NaNs (not-a-number values), since C<< <=> >>
2912returns C<undef> for those. This brings it in line with
2913S<C<< sort { 1; $a <=> $b } >>> and other more complex cases, which are not
2914optimised [perl #94390].
edc1ae43
FC
2915
2916=back
2917
581af396 2918=head2 The C<substr> operator
288a601f
FC
2919
2920=over
2921
2922=item *
2923
581af396
RS
2924Tied (and otherwise magical) variables are no longer exempt from the
2925"Attempt to use reference as lvalue in substr" warning.
288a601f
FC
2926
2927=item *
2928
581af396
RS
2929That warning now occurs when the returned lvalue is assigned to, not
2930when C<substr> itself is called. This only makes a difference if the
2931return value of C<substr> is referenced and assigned to later.
288a601f
FC
2932
2933=item *
2934
581af396
RS
2935Passing a substring of a read-only value or a typeglob to a function
2936(potential lvalue context) no longer causes an immediate "Can't coerce"
2937or "Modification of a read-only value" error. That error only occurs
2938if and when the value passed is assigned to.
288a601f 2939
581af396
RS
2940The same thing happens with the "substr outside of string" error. If
2941the lvalue is only read, not written to, it is now just a warning, as
2942with rvalue C<substr>.
288a601f
FC
2943
2944=item *
2945
581af396
RS
2946C<substr> assignments no longer call FETCH twice if the first argument
2947is a tied variable, just once.
2948
2949=back
2950
2951=head2 Support for embedded nulls
2952
2953Some parts of Perl did not work correctly with nulls (C<chr 0>) embedded in
2954strings. That meant that, for instance, C<< $m = "a\0b"; foo->$m >> would
2955call the "a" method, instead of the actual method name contained in $m.
2956These parts of perl have been fixed to support nulls:
2957
2958=over
288a601f
FC
2959
2960=item *
2961
581af396 2962Method names
288a601f 2963
581af396 2964=item *
288a601f 2965
581af396 2966Typeglob names (including filehandle and subroutine names)
288a601f 2967
581af396 2968=item *
78c5646a 2969
581af396 2970Package names, including the return value of C<ref()>
78c5646a
FC
2971
2972=item *
2973
581af396 2974Typeglob elements (C<*foo{"THING\0stuff"}>)
78c5646a
FC
2975
2976=item *
2977
581af396 2978Signal names
78c5646a
FC
2979
2980=item *
2981
581af396
RS
2982Various warnings and error messages that mention variable names or values,
2983methods, etc.
78c5646a
FC
2984
2985=back
2986
581af396
RS
2987One side effect of these changes is that blessing into "\0" no longer
2988causes C<ref()> to return false.
2989
2990=head2 Threading bugs
fdf8c809
FC
2991
2992=over
2993
2994=item *
2995
581af396
RS
2996Typeglobs returned from threads are no longer cloned if the parent thread
2997already has a glob with the same name. This means that returned
2998subroutines will now assign to the right package variables [perl #107366].
fdf8c809
FC
2999
3000=item *
3001
581af396
RS
3002Some cases of threads crashing due to memory allocation during cloning have
3003been fixed [perl #90006].
fdf8c809
FC
3004
3005=item *
3006
581af396
RS
3007Thread joining would sometimes emit "Attempt to free unreferenced scalar"
3008warnings if C<caller> had been used from the C<DB> package prior to thread
3009creation [perl #98092].
fdf8c809
FC
3010
3011=item *
3012
581af396
RS
3013Locking a subroutine (via C<lock &sub>) is no longer a compile-time error
3014for regular subs. For lvalue subroutines, it no longer tries to return the
3015sub as a scalar, resulting in strange side effects like C<ref \$_>
3016returning "CODE" in some instances.
fdf8c809 3017
581af396
RS
3018C<lock &sub> is now a run-time error if L<threads::shared> is loaded (a
3019no-op otherwise), but that may be rectified in a future version.
fdf8c809
FC
3020
3021=back
3022
581af396 3023=head2 Tied variables
ad275677
FC
3024
3025=over
3026
3027=item *
3028
581af396
RS
3029Various cases in which FETCH was being ignored or called too many times
3030have been fixed:
ad275677 3031
581af396 3032=over
ad275677
FC
3033
3034=item *
3035
581af396 3036C<PerlIO::get_layers> [perl #97956]
ad275677
FC
3037
3038=item *
3039
581af396
RS
3040C<$tied =~ y/a/b/>, C<chop $tied> and C<chomp $tied> when $tied holds a
3041reference.
ad275677
FC
3042
3043=item *
3044
581af396 3045When calling C<local $_> [perl #105912]
ad275677 3046
581af396 3047=item *
39ae1ea7 3048
581af396 3049Four-argument C<select>
39ae1ea7
FC
3050
3051=item *
3052
581af396 3053A tied buffer passed to C<sysread>
39ae1ea7
FC
3054
3055=item *
3056
581af396 3057C<< $tied .= <> >>
39ae1ea7
FC
3058
3059=item *
3060
581af396
RS
3061Three-argument C<open>, the third being a tied file handle
3062(as in C<< open $fh, ">&", $tied >>)
39ae1ea7 3063
581af396 3064=item *
10ba0d31 3065
581af396 3066C<sort> with a reference to a tied glob for the comparison routine.
22ae2565 3067
10ba0d31
FC
3068=item *
3069
581af396 3070C<..> and C<...> in list context [perl #53554].
10ba0d31
FC
3071
3072=item *
3073
581af396
RS
3074C<${$tied}>, C<@{$tied}>, C<%{$tied}> and C<*{$tied}> where the tied
3075variable returns a string (C<&{}> was unaffected)
10ba0d31
FC
3076
3077=item *
3078
581af396 3079C<defined ${ $tied_variable }>
10ba0d31 3080
581af396 3081=item *
10ba0d31 3082
581af396
RS
3083Various functions that take a filehandle argument in rvalue context
3084(C<close>, C<readline>, etc.) [perl #97482]
4fad228f 3085
581af396
RS
3086=item *
3087
3088Some cases of dereferencing a complex expression, such as
3089C<${ (), $tied } = 1>, used to call C<FETCH> multiple times, but now call
3090it once.
4fad228f
FC
3091
3092=item *
3093
581af396
RS
3094C<$tied-E<gt>method> where $tied returns a package name--even resulting in
3095a failure to call the method, due to memory corruption
4fad228f
FC
3096
3097=item *
3098
581af396 3099Assignments like C<*$tied = \&{"..."}> and C<*glob = $tied>
4fad228f
FC
3100
3101=item *
3102
581af396
RS
3103C<chdir>, C<chmod>, C<chown>, C<utime>, C<truncate>, C<stat>, C<lstat> and
3104the filetest ops (C<-r>, C<-x>, etc.)
4fad228f
FC
3105
3106=back
3107
581af396 3108=item *
fbd7c082 3109
581af396
RS
3110C<caller> sets C<@DB::args> to the subroutine arguments when called from
3111the DB package. It used to crash when doing so if C<@DB::args> happened to
3112be tied. Now it croaks instead.
fbd7c082
FC
3113
3114=item *
3115
581af396
RS
3116Tying an element of %ENV or C<%^H> and then deleting that element would
3117result in a call to the tie object's DELETE method, even though tying the
3118element itself is supposed to be equivalent to tying a scalar (the element
3119is, of course, a scalar) [perl #67490].
fbd7c082
FC
3120
3121=item *
3122
581af396
RS
3123When Perl autovivifies an element of a tied array or hash (which entails
3124calling STORE with a new reference), it now calls FETCH immediately after
3125the STORE, instead of assuming that FETCH would have returned the same
3126reference. This can make it easier to implement tied objects [perl #35865, #43011].
fbd7c082
FC
3127
3128=item *
3129
581af396
RS
3130Four-argument C<select> no longer produces its "Non-string passed as
3131bitmask" warning on tied or tainted variables that are strings.
fbd7c082
FC
3132
3133=item *
3134
581af396
RS
3135Localising a tied scalar that returns a typeglob no longer stops it from
3136being tied till the end of the scope.
fbd7c082 3137
581af396
RS
3138=item *
3139
3140Attempting to C<goto> out of a tied handle method used to cause memory
3141corruption or crashes. Now it produces an error message instead
3142[perl #8611].
3143
3144=item *
3145
3146A bug has been fixed that occurs when a tied variable is used as a
3147subroutine reference: if the last thing assigned to or returned from the
3148variable was a reference or typeglob, the C<\&$tied> could either crash or
3149return the wrong subroutine. The reference case is a regression introduced
3150in Perl 5.10.0. For typeglobs, it has probably never worked till now.
fbd7c082
FC
3151
3152=back
3153
581af396 3154=head2 Version objects and vstrings
22ae2565
FC
3155
3156=over
3157
3158=item *
3159
581af396
RS
3160The bitwise complement operator (and possibly other operators, too) when
3161passed a vstring would leave vstring magic attached to the return value,
3162even though the string had changed. This meant that
3163C<< version->new(~v1.2.3) >> would create a version looking like "v1.2.3"
3164even though the string passed to C<< version->new >> was actually
3165"\376\375\374". This also caused L<B::Deparse> to deparse C<~v1.2.3>
3166incorrectly, without the C<~> [perl #29070].
22ae2565
FC
3167
3168=item *
3169
581af396
RS
3170Assigning a vstring to a magic (e.g., tied, C<$!>) variable and then
3171assigning something else used to blow away all the magic. This meant that
3172tied variables would come undone, C<$!> would stop getting updated on
3173failed system calls, C<$|> would stop setting autoflush, and other
3174mischief would take place. This has been fixed.
22ae2565
FC
3175
3176=item *
3177
581af396
RS
3178C<< version->new("version") >> and C<printf "%vd", "version"> no longer
3179crash [perl #102586].
3180
3181=item *
3182
3183Version comparisons, such as those that happen implicitly with C<use
3184v5.43>, no longer cause locale settings to change [perl #105784].
3185
3186=item *
3187
3188Version objects no longer cause memory leaks in boolean context
3189[perl #109762].
22ae2565
FC
3190
3191=back
3192
581af396 3193=head2 Warnings, redefinition
22ae2565
FC
3194
3195=over
3196
3197=item *
3198
581af396
RS
3199Subroutines from the C<autouse> namespace are once more exempt from
3200redefinition warnings. This used to work in 5.005, but was broken in
32015.6 for most subroutines. For subs created via XS that redefine
3202subroutines from the C<autouse> package, this stopped working in 5.10.
22ae2565
FC
3203
3204=item *
3205
581af396
RS
3206New XSUBs now produce redefinition warnings if they overwrite existing
3207subs, as they did in 5.8.x. (The C<autouse> logic was reversed in
32085.10-14. Only subroutines from the C<autouse> namespace would warn
3209when clobbered.)
22ae2565
FC
3210
3211=item *
3212
581af396
RS
3213C<newCONSTSUB> used to use compile-time warning hints, instead of
3214run-time hints. The following code should never produce a redefinition
3215warning, but it used to, if C<newCONSTSUB> redefined an existing
3216subroutine:
22ae2565 3217
581af396
RS
3218 use warnings;
3219 BEGIN {
3220 no warnings;
3221 some_XS_function_that_calls_new_CONSTSUB();
3222 }
22ae2565
FC
3223
3224=item *
3225
581af396
RS
3226Redefinition warnings for constant subroutines are on by default (what
3227are known as severe warnings in L<perldiag>). This was only the case
3228when it was a glob assignment or declaration of a Perl subroutine that
3229caused the warning. If the creation of XSUBs triggered the warning, it
3230was not a default warning. This has been corrected.
3231
3232=item *
3233
3234The internal check to see whether a redefinition warning should occur
3235used to emit "uninitialized" warnings in cases like this:
3236
3237 use warnings "uninitialized";
3238 use constant {u => undef, v => undef};
3239 sub foo(){u}
3240 sub foo(){v}
22ae2565
FC
3241
3242=back
3243
581af396 3244=head2 Warnings, "Uninitialized"
61f055fd
FC
3245
3246=over
3247
3248=item *
3249
581af396
RS
3250Various functions that take a filehandle argument in rvalue context
3251(C<close>, C<readline>, etc.) used to warn twice for an undefined handle
3252[perl #97482].
61f055fd
FC
3253
3254=item *
3255
581af396
RS
3256C<dbmopen> now only warns once, rather than three times, if the mode
3257argument is C<undef> [perl #90064].
61f055fd 3258
581af396 3259=item *
61f055fd 3260
581af396
RS
3261The C<+=> operator does not usually warn when the left-hand side is
3262C<undef>, but it was doing so for tied variables. This has been fixed
3263[perl #44895].
61f055fd
FC
3264
3265=item *
3266
581af396
RS
3267A bug fix in Perl 5.14 introduced a new bug, causing "uninitialized"
3268warnings to report the wrong variable if the operator in question had
3269two operands and one was C<%{...}> or C<@{...}>. This has been fixed
3270[perl #103766].
61f055fd
FC
3271
3272=item *
3273
581af396
RS
3274C<..> and C<...> in list context now mention the name of the variable in
3275"uninitialized" warnings for string (as opposed to numeric) ranges.
3276
3277=back
3278
3279=head2 Weak references
3280
3281=over
61f055fd
FC
3282
3283=item *
3284
581af396
RS
3285Weakening the first argument to an automatically-invoked C<DESTROY> method
3286could result in erroneous "DESTROY created new reference" errors or
3287crashes. Now it is an error to weaken a read-only reference.
61f055fd 3288
d38c78ed
FC
3289=item *
3290
581af396
RS
3291Weak references to lexical hashes going out of scope were not going stale
3292(becoming undefined), but continued to point to the hash.
d38c78ed 3293
fb83b884
FC
3294=item *
3295
581af396
RS
3296Weak references to lexical variables going out of scope are now broken
3297before any magical methods (e.g., DESTROY on a tie object) are called.
3298This prevents such methods from modifying the variable that will be seen
3299the next time the scope is entered.
3300
3301=item *
3302
3303Creating a weak reference to an @ISA array or accessing the array index
3304(C<$#ISA>) could result in confused internal bookkeeping for elements
3305subsequently added to the @ISA array. For instance, creating a weak
3306reference to the element itself could push that weak reference on to @ISA;
3307and elements added after use of C<$#ISA> would be ignored by method lookup
3308[perl #85670].
fb83b884 3309
61f055fd
FC
3310=back
3311
edc1ae43
FC
3312=head2 Other notable fixes
3313
3314=over
3315
021c503d 3316=item *
cb82babd 3317
77649ca9
RS
3318C<quotemeta> now quotes consistently the same non-ASCII characters under
3319C<use feature 'unicode_strings'>, regardless of whether the string is
3320encoded in UTF-8 or not, hence fixing the last vestiges (we hope) of the
3321infamous L<perlunicode/The "Unicode Bug">. [perl #77654].
3322
3323Which of these code points is quoted has changed, based on Unicode's
3324recommendations. See L<perlfunc/quotemeta> for details.
3325
3326=item *
3327
cb82babd
RS
3328When one writes C<open foo || die>, which used to work in Perl 4, a
3329"Precedence problem" warning is produced. This warning used erroneously to
3330apply to fully-qualified bareword handle names not followed by C<||>. This
3331has been corrected.
3332
021c503d
RS
3333=item *
3334
cb82babd
RS
3335After package aliasing (C<*foo:: = *bar::>), C<select> with 0 or 1 argument
3336would sometimes return a name that could not be used to refer to the
3337filehandle, or sometimes it would return C<undef> even when a filehandle
3338was selected. Now it returns a typeglob reference in such cases.
3339
021c503d
RS
3340=item *
3341
cb82babd
RS
3342C<PerlIO::get_layers> no longer ignores some arguments that it thinks are
3343numeric, while treating others as filehandle names. It is now consistent
3344for flat scalars (i.e., not references).
3345
021c503d
RS
3346=item *
3347
021c503d 3348Unrecognised switches on C<#!> line
cb82babd
RS
3349
3350If a switch, such as B<-x>, that cannot occur on the C<#!> line is used
3351there, perl dies with "Can't emulate...".
3352
3353It used to produce the same message for switches that perl did not
3354recognise at all, whether on the command line or the C<#!> line.
3355
3356Now it produces the "Unrecognized switch" error message [perl #104288].
3357
021c503d
RS
3358=item *
3359
cb82babd
RS
3360C<system> now temporarily blocks the SIGCHLD signal handler, to prevent the
3361signal handler from stealing the exit status [perl #105700].
3362
021c503d
RS
3363=item *
3364
cd4adf6c 3365The %n formatting code for C<printf> and C<sprintf>, which causes the number
3e91afe7 3366of characters to be assigned to the next argument, now actually
cb82babd
RS
3367assigns the number of characters, instead of the number of bytes.
3368
3369It also works now with special lvalue functions like C<substr> and with
3370nonexistent hash and array elements [perl #3471, #103492].
3371
021c503d
RS
3372=item *
3373
8b80cdcf
FC
3374Perl skips copying values returned from a subroutine, for the sake of
3375speed, if doing so would make no observable difference. Due to faulty
3376logic, this would happen with the
3377result of C<delete>, C<shift> or C<splice>, even if the result was
3378referenced elsewhere. It also did so with tied variables about to be freed
3379[perl #91844, #95548].
cb82babd 3380
021c503d 3381=item *
cb82babd
RS
3382
3383C<utf8::decode> now refuses to modify read-only scalars [perl #91850].
3384
021c503d
RS
3385=item *
3386
3c8a1310
FC
3387Freeing $_ inside a C<grep> or C<map> block, a code block embedded in a
3388regular expression, or an @INC filter (a subroutine returned by a
3389subroutine in @INC) used to result in double frees or crashes
3390[perl #91880, #92254, #92256].
cb82babd 3391
021c503d
RS
3392=item *
3393
021c503d
RS
3394C<eval> returns C<undef> in scalar context or an empty list in list
3395context when there is a run-time error. When C<eval> was passed a
3396string in list context and a syntax error occurred, it used to return a
3397list containing a single undefined element. Now it returns an empty
3398list in list context for all errors [perl #80630].
412912b6
RS
3399
3400=item *
3401
3402C<goto &func> no longer crashes, but produces an error message, when
3403the unwinding of the current subroutine's scope fires a destructor that
3404undefines the subroutine being "goneto" [perl #99850].
3405
3406=item *
3407
b325a3a2 3408Perl now holds an extra reference count on the package that code is
cdea750a
RS
3409currently compiling in. This means that the following code no longer
3410crashes [perl #101486]:
b325a3a2
RS
3411
3412 package Foo;
3413 BEGIN {*Foo:: = *Bar::}
3414 sub foo;
3415
3416=item *
3417
b325a3a2
RS
3418The C<x> repetition operator no longer crashes on 64-bit builds with large
3419repeat counts [perl #94560].
3420
3421=item *
3422
b325a3a2
RS
3423Calling C<require> on an implicit C<$_> when C<*CORE::GLOBAL::require> has
3424been overridden does not segfault anymore, and C<$_> is now passed to the
3425overriding subroutine [perl #78260].
3426
3427=item *
3428
12477442
RS
3429C<use> and C<require> are no longer affected by the I/O layers active in
3430the caller's scope (enabled by L<open.pm|open>) [perl #96008].
3431
3432=item *
3433
12477442
RS
3434C<our $::Ć©; $Ć©> (which is invalid) no longer produces the "Compilation
3435error at lib/utf8_heavy.pl..." error message, which it started emitting in
34365.10.0 [perl #99984].
3437
3438=item *
3439
12477442
RS
3440On 64-bit systems, C<read()> now understands large string offsets beyond
3441the 32-bit range.
3442
3443=item *
3444
3445Errors that occur when processing subroutine attributes no longer cause the
3446subroutine's op tree to leak.
3447
3448=item *
3449
a14d7d4a
RS
3450Passing the same constant subroutine to both C<index> and C<formline> no
3451longer causes one or the other to fail [perl #89218]. (5.14.1)
3452
3453=item *
3454
3455List assignment to lexical variables declared with attributes in the same
3456statement (C<my ($x,@y) : blimp = (72,94)>) stopped working in Perl 5.8.0.
3457It has now been fixed.
3458
3459=item *
3460
3461Perl 5.10.0 introduced some faulty logic that made "U*" in the middle of
3462a pack template equivalent to "U0" if the input string was empty. This has
3463been fixed [perl #90160].
3464
3465=item *
3466
3467Destructors on objects were not called during global destruction on objects
3468that were not referenced by any scalars. This could happen if an array
3469element were blessed (e.g., C<bless \$a[0]>) or if a closure referenced a
3470blessed variable (C<bless \my @a; sub foo { @a }>).
3471
3472Now there is an extra pass during global destruction to fire destructors on
3473any objects that might be left after the usual passes that check for
3474objects referenced by scalars [perl #36347].
3475
a14d7d4a
RS
3476=item *
3477
a14d7d4a
RS
3478Fixed a case where it was possible that a freed buffer may have been read
3479from when parsing a here document [perl #90128]. (5.14.1)
3480
3481=item *
3482
a14d7d4a
RS
3483C<each(I<ARRAY>)> is now wrapped in C<defined(...)>, like C<each(I<HASH>)>,
3484inside a C<while> condition [perl #90888].
3485
3486=item *
a14d7d4a 3487
ccad93fd
RS
3488A problem with context propagation when a C<do> block is an argument to
3489C<return> has been fixed. It used to cause C<undef> to be returned in
3490some cases of a C<return> inside an C<if> block which itself is followed by
3491another C<return>.
3492
3493=item *
3494
3495Calling C<index> with a tainted constant no longer causes constants in
3496subsequently compiled code to become tainted [perl #64804].
3497
3498=item *
3499
94c11dd4
RS
3500Infinite loops like C<1 while 1> used to stop C<strict 'subs'> mode from
3501working for the rest of the block.t
3502
3503=item *
3504
94c11dd4
RS
3505For list assignments like C<($a,$b) = ($b,$a)>, Perl has to make a copy of
3506the items on the right-hand side before assignment them to the left. For
3507efficiency's sake, it assigns the values on the right straight to the items
0ecf7720
RS
3508on the left if no one variable is mentioned on both sides, as in C<($a,$b) =
3509($c,$d)>. The logic for determining when it can cheat was faulty, in that
3510C<&&> and C<||> on the right-hand side could fool it. So C<($a,$b) =
3511$some_true_value && ($b,$a)> would end up assigning the value of C<$b> to
3512both scalars.
94c11dd4
RS
3513
3514=item *
3515
3516Perl no longer tries to apply lvalue context to the string in
3517C<("string", $variable) ||= 1> (which used to be an error). Since the
3518left-hand side of C<||=> is evaluated in scalar context, that's a scalar
3519comma operator, which gives all but the last item void context. There is
3520no such thing as void lvalue context, so it was a mistake for Perl to try
3521to force it [perl #96942].
3522
3523=item *
3524
94c11dd4
RS
3525C<caller> no longer leaks memory when called from the DB package if
3526C<@DB::args> was assigned to after the first call to C<caller>. L<Carp>
3527was triggering this bug [perl #97010].
3528
4bbade93 3529=item *
30682cc3 3530
4bbade93
RS
3531C<close> and similar filehandle functions, when called on built-in global
3532variables (like C<$+>), used to die if the variable happened to hold the
3533undefined value, instead of producing the usual "Use of uninitialized
3534value" warning.
3535
3536=item *
3537
3538When autovivified file handles were introduced in Perl 5.6.0, C<readline>
3539was inadvertently made to autovivify when called as C<readline($foo)> (but
3540not as C<E<lt>$fooE<gt>>). It has now been fixed never to autovivify.
3541
3542=item *
3543
4bbade93
RS
3544Calling an undefined anonymous subroutine (e.g., what $x holds after
3545C<undef &{$x = sub{}}>) used to cause a "Not a CODE reference" error, which
3546has been corrected to "Undefined subroutine called" [perl #71154].
3547
3548=item *
3549
3550Causing C<@DB::args> to be freed between uses of C<caller> no longer
3551results in a crash [perl #93320].
3552
3553=item *
3554
4bbade93
RS
3555C<setpgrp($foo)> used to be equivalent to C<($foo, setpgrp)>, because
3556C<setpgrp> was ignoring its argument if there was just one. Now it is
3557equivalent to C<setpgrp($foo,0)>.
3558
3559=item *
30682cc3 3560
4bbade93
RS
3561C<shmread> was not setting the scalar flags correctly when reading from
3562shared memory, causing the existing cached numeric representation in the
3563scalar to persist [perl #98480].
3564
3565=item *
3566
4bbade93
RS
3567C<++> and C<--> now work on copies of globs, instead of dying.
3568
3569=item *
3570
021c503d
RS
3571C<splice()> doesn't warn when truncating
3572
3573You can now limit the size of an array using C<splice(@a,MAX_LEN)> without
3574worrying about warnings.
3575
77649ca9
RS
3576=item *
3577
d005e6a6 3578C<< $$ >> is no longer tainted. Since this value comes directly from
6d365783
FC
3579C<< getpid() >>, it is always safe.
3580
3581=item *
3582
3583The parser no longer leaks a filehandle if STDIN was closed before parsing
3584started [perl #37033].
3585
3586=item *
3587
6d365783 3588C<< die; >> with a non-reference, non-string, or magical (e.g., tainted)
cdea750a 3589value in $@ now properly propagates that value [perl #111654].
6d365783 3590
4bbade93
RS
3591=back
3592
3593=head1 Known Problems
30682cc3
RS
3594
3595=over 4
3596
3597=item *
3598
4bbade93
RS
3599On Solaris, we have two kinds of failure.
3600
3601If F<make> is Sun's F<makeā‰„>, we get an error about a badly formed macro
4d6200df
FC
3602assignment in the F<Makefile>. That happens when F<./Configure> tries to
3603make depends. F<Configure> then exits 0, but further F<make>-ing fails.
4bbade93
RS
3604
3605If F<make> is F<gmake>, F<Configure> completes, then we get errors related
3606to F</usr/include/stdbool.h>
30682cc3 3607
04e04589
FC
3608=item *
3609
3610The following CPAN modules have test failures with perl 5.16. Patches have
3611been submitted for all of these, so hopefully there will be new releases
3612soon:
3613
3614=over
3615
3616=item *
3617
3618L<Date::Pcalc> version 6.1
3619
3620=item *
3621
04e04589
FC
3622L<Module::CPANTS::Analyse> version 0.85
3623
3624This fails due to problems in L<Module::Find> 0.10 and L<File::MMagic>
36251.27.
3626
3627=item *
3628
3629L<PerlIO::Util> version 0.72
3630
04e04589
FC
3631=back
3632
30682cc3
RS
3633=back
3634
30682cc3
RS
3635=head1 Acknowledgements
3636
3637XXX Generate this with:
3638
021c503d 3639 perl Porting/acknowledgements.pl v5.14.0..HEAD
30682cc3
RS
3640
3641=head1 Reporting Bugs
3642
3643If you find what you think is a bug, you might check the articles
3644recently posted to the comp.lang.perl.misc newsgroup and the perl
021c503d
RS
3645bug database at L<http://rt.perl.org/perlbug/>. There may also be
3646information at L<http://www.perl.org/>, the Perl Home Page.
30682cc3
RS
3647
3648If you believe you have an unreported bug, please run the L<perlbug>
3649program included with your release. Be sure to trim your bug down
3650to a tiny but sufficient test case. Your bug report, along with the
3651output of C<perl -V>, will be sent off to perlbug@perl.org to be
3652analysed by the Perl porting team.
3653
3654If the bug you are reporting has security implications, which make it
021c503d 3655inappropriate to send to a publicly archived mailing list, then please
4d6200df 3656send it to perl5-security-report@perl.org. This points to a closed
021c503d
RS
3657subscription unarchived mailing list, which includes all the core
3658committers, who will be able to help assess the impact of issues, figure
3659out a resolution, and help co-ordinate the release of patches to
3660mitigate or fix the problem across all platforms on which Perl is
4d6200df 3661supported. Please only use this address for security issues in the Perl
021c503d 3662core, not for modules independently distributed on CPAN.
30682cc3
RS
3663
3664=head1 SEE ALSO
3665
3666The F<Changes> file for an explanation of how to view exhaustive details
3667on what changed.
3668
3669The F<INSTALL> file for how to build Perl.
3670
3671The F<README> file for general stuff.
3672
3673The F<Artistic> and F<Copying> files for copyright information.
3674
3675=cut