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