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