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