This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove all the boilerplate notes from perldelta
[perl5.git] / pod / perldelta.pod
CommitLineData
44691e6f
AB
1=encoding utf8
2
00dc1094
FC
3=for to-do
423b7025ebc definitely needs to be summarised.
5
44691e6f
AB
6=head1 NAME
7
e14ac59b 8perldelta - what is new for perl v5.17.7
e128ab2c 9
4eabcf70 10=head1 DESCRIPTION
6db9054f 11
e14ac59b 12This document describes differences between the 5.17.6 release and the 5.17.7
e08634c5 13release.
6db9054f 14
e14ac59b
RS
15If you are upgrading from an earlier release such as 5.17.5, first read
16L<perl5176delta>, which describes differences between 5.17.5 and 5.17.6.
17
5d8c8c8a 18=head1 Core Enhancements
4db91b87 19
e078d89d 20=head2 $&, $` and $' are no longer slow
bde9e88d 21
e078d89d
FC
22These three infamous variables have been redeemed and no longer slow down
23your program when used. Hence, the /p regular expression flag now does
24nothing.
bde9e88d 25
e14ac59b 26=head1 Security
86148eee 27
e14ac59b 28=head1 Incompatible Changes
90249f0a 29
3ef6ec90
TC
30=head2 readline() with C<$/ = \N> now reads N characters, not N bytes
31
32Previously, when reading from a stream with I/O layers such as
33C<encoding>, the readline() function, otherwise known as the C<< <> >>
34operator, would read I<N> bytes from the top-most layer. [perl #79960]
35
36Now, I<N> characters are read instead.
37
38There is no change in behaviour when reading from streams with no
39extra layers, since bytes map exactly to characters.
40
9a0708b2 41=head2 Lexical subroutine warnings have moved
90249f0a 42
9a0708b2
FC
43The warning about the use of an experimental feature emitted when lexical
44subroutines (added in 5.17.4) are used now happens when the subroutine
45itself is declared, not when the "lexical_subs" feature is activated via
46C<use feature>.
4d7cd482 47
9a0708b2
FC
48This stops C<use feature ':all'> from warning, but causes
49C<my sub foo; my sub bar> to warn twice.
4d7cd482 50
b7c7d786
FC
51=head2 Overridden C<glob> is now passed one argument
52
53C<glob> overrides used to be passed a magical undocumented second argument
54that identified the caller. Nothing on CPAN was using this, and it got in
55the way of a bug fix, so it was removed. If you really need to identify
56the caller, see L<Devel::Callsite> on CPAN.
57
e14ac59b 58=head1 Deprecations
4d7cd482 59
751611d4
FC
60=head2 Lexical $_ is now deprecated
61
62Since it was introduced in Perl 5.10, it has caused much confusion with no
63obvious solution:
64
65=over
66
67=item *
68
69Various modules (e.g., List::Util) expect callback routines to use the
70global $_. C<use List::Util 'first'; my $_; first { $_ == 1 } @list> does
71not work as one would expect.
72
73=item *
74
75A C<my $_> declaration earlier in the same file can cause confusing closure
76warnings.
77
78=item *
79
80The "_" subroutine prototype character allows called subroutines to access
81your lexical $_, so it is not really private after all.
82
83=item *
84
85Nevertheless, subroutines with a "(@)" prototype and methods cannot access
86the caller's lexical $_, unless they are written in XS.
87
88=item *
89
90But even XS routines cannot access a lexical $_ declared, not in the
91calling subroutine, but in an outer scope, iff that subroutine happened not
92to mention $_ or use any operators that default to $_.
93
94=back
95
61b19385
KW
96=head2 Various XS-callable functions are now deprecated
97
98The following functions will be removed from a future version of Perl,
99and should not be used. With participating C compilers (e.g., gcc),
100compiling any file that uses any of these will generate a warning.
101These were not intended for public use; there are equivalent, faster,
102macros for most of them. See L<perlapi/Character classes>:
103C<is_uni_ascii>,
104C<is_uni_ascii_lc>,
105C<is_uni_blank>,
106C<is_uni_blank_lc>,
107C<is_uni_cntrl>,
108C<is_uni_cntrl_lc>,
109C<is_uni_idfirst_lc>,
110C<is_uni_space>,
111C<is_uni_space_lc>,
112C<is_uni_xdigit>,
113C<is_uni_xdigit_lc>,
114C<is_utf8_ascii>,
115C<is_utf8_blank>,
116C<is_utf8_cntrl>,
117C<is_utf8_idcont>,
118C<is_utf8_idfirst>,
119C<is_utf8_perl_space>,
120C<is_utf8_perl_word>,
121C<is_utf8_posix_digit>,
122C<is_utf8_space>,
123C<is_utf8_xdigit>.
124C<is_utf8_xidcont>,
125C<is_utf8_xidfirst>,
126C<to_uni_lower_lc>,
127C<to_uni_title_lc>,
128and
129C<to_uni_upper_lc>.
130
e14ac59b 131=head1 Performance Enhancements
86148eee 132
e14ac59b 133=over 4
7a7a10c7 134
e14ac59b 135=item *
7a7a10c7 136
e078d89d
FC
137Perl has a new copy-on-write mechanism that avoids the need to copy the
138internal string buffer when assigning from one scalar to another. This
139makes copying large strings appear much faster. Modifying one of the two
140(or more) strings after an assignment will force a copy internally. This
141makes it unnecessary to pass strings by reference for efficiency.
7a7a10c7 142
e14ac59b 143=back
7a7a10c7 144
e14ac59b 145=head1 Modules and Pragmata
7a7a10c7 146
e14ac59b 147=head2 Updated Modules and Pragmata
c387386a 148
e14ac59b 149=over 4
32209f41 150
e14ac59b 151=item *
5faa50e9 152
b7c7d786
FC
153L<File::DosGlob> has been upgraded from version 1.08 to 1.09. The internal
154cache of file names that it keeps for each caller is now freed when that
155caller is freed. This means
156C<< use File::DosGlob 'glob'; eval 'scalar <*>' >> no longer leaks memory.
157
158=item *
159
160L<File::Glob> has been upgraded from version 1.18 to 1.19. File::Glob has
161had exactly the same fix as File::DosGlob. Since it is what Perl's own
162C<glob> operator itself uses (except on VMS), this means
163C<< eval 'scalar <*>' >> no longer leaks.
164
165=item *
166
476161f6
NC
167L<GDBM_File> has been upgraded from version 1.14 to 1.15. The undocumented
168optional fifth parameter to C<TIEHASH> has been removed. This was intended
169to provide control of the callback used by C<gdbm*> functions in case of
170fatal errors (such as filesystem problems), but did not work (and could
171never have worked). No code on CPAN even attempted to use it. The callback
172is now always the previous default, C<croak>. Problems on some platforms with
173how the C<C> C<croak> function is called have also been resolved.
5faa50e9 174
e14ac59b
RS
175=back
176
e14ac59b 177=head1 Documentation
11e375e0 178
e14ac59b 179=head2 Changes to Existing Documentation
11e375e0 180
243effed 181=head3 L<perlapi/Character classes>
11e375e0 182
e14ac59b 183=over 4
e498bd59
RS
184
185=item *
186
243effed
KW
187There are quite a few macros callable from XS modules that classify
188characters into things like alphabetic, punctuation, etc. More of these
189are now documented, including ones which work on characters whose code
190points are outside the Latin-1 range.
cb077ed2 191
5d8c8c8a 192=back
5f877a7f 193
e14ac59b
RS
194=head1 Diagnostics
195
196The following additions or changes have been made to diagnostic output,
197including warnings and fatal error messages. For the complete list of
198diagnostic messages, see L<perldiag>.
1ea91bbe 199
e14ac59b
RS
200=head2 Changes to Existing Diagnostics
201
5d8c8c8a 202=over 4
5faa50e9 203
e14ac59b 204=item *
ddb1bef5 205
7564097e
FC
206L<Constant(%s): Call to &{$^H{%s}} did not return a defined value|perldiag/Constant(%s): Call to &{$^H{%s}} did not return a defined value>
207
208Constant overloading that returns C<undef> results in this error message.
209For numeric constants, it used to say "Constant(undef)". "undef" has been
3ccac37f 210replaced with the number itself.
11e375e0 211
e14ac59b 212=back
11e375e0 213
e14ac59b 214=head1 Internal Changes
11e375e0 215
e14ac59b 216=over 4
11e375e0
FC
217
218=item *
219
463ea229
DM
220SvUPGRADE() is no longer an expression. Originally this macro (and its
221underlying function, sv_upgrade()) were documented as boolean, although
222in reality they always croaked on error and never returned false. In 2005
223the documentation was updated to specify a void return value, but
224SvUPGRADE() was left always returning 1 for backwards compatibility. This
225has now been removed, and SvUPGRADE() is now a statement with no return
226value.
227
228So this is now a syntax error:
229
230 if (!SvUPGRADE(sv)) { croak(...); }
231
232If you have code like that, simply replace it with
233
234 SvUPGRADE(sv);
e14ac59b 235
8b877d20
DM
236or to to avoid compiler warnings with older perls, possibly
237
238 (void)SvUPGRADE(sv);
239
e078d89d
FC
240=item *
241
242Perl has a new copy-on-write mechanism that allows any SvPOK scalar to be
243upgraded to a copy-on-write scalar. A reference count on the string buffer
244is stored in the string buffer itself.
245
246This breaks a few XS modules by allowing copy-on-write scalars to go
247through code paths that never encountered them before.
248
249This behaviour can still be disabled by running F<Configure> with
250B<-Accflags=-DPERL_NO_COW>. This option will probably be removed in Perl
2515.20.
252
253=item *
254
255Copy-on-write no longer uses the SvFAKE and SvREADONLY flags. Hence,
256SvREADONLY indicates a true read-only SV.
257
258Use the SvIsCOW macro (as before) to identify a copy-on-write scalar.
259
260=item *
261
262C<PL_sawampersand> is now a constant. The switch this variable provided
263(to enable/disable the pre-match copy depending on whether C<$&> had been
264seen) has been removed and replaced with copy-on-write, eliminating a few
265bugs.
266
267The previous behaviour can still be enabled by running F<Configure> with
268B<-Accflags=-DPERL_SAWAMPERSAND>.
269
b7c7d786
FC
270=item *
271
272PL_glob_index is gone.
273
e14ac59b
RS
274=back
275
276=head1 Selected Bug Fixes
277
e14ac59b 278=over 4
11e375e0
FC
279
280=item *
281
8b998a90
FC
282C<sort {undef} ...> under fatal warnings no longer crashes. It started
283crashing in Perl 5.16.
e14ac59b 284
fdea6f98
FC
285=item *
286
287Stashes blessed into each other
288(C<bless \%Foo::, 'Bar'; bless \%Bar::, 'Foo'>) no longer result in double
289frees. This bug started happening in Perl 5.16.
290
7cf3104f
FC
291=item *
292
293Numerous memory leaks have been fixed, mostly involving fatal warnings and
294syntax errors.
295
966f0fdb
FC
296=item *
297
298Lexical constants (C<my sub answer () { 42 }>) no longer cause double
299frees.
300
edc013cb
FC
301=item *
302
303Constant subroutine redefinition warns by default, but lexical constants
304were accidentally exempt from default warnings. This has been corrected.
305
7b5dd02a
FC
306=item *
307
308Some failed regular expression matches such as C<'f' =~ /../g> were not
309resetting C<pos>. Also, "match-once" patterns (C<m?...?g>) failed to reset
310it, too, when invoked a second time [perl #23180].
311
e078d89d
FC
312=item *
313
314Accessing C<$&> after a pattern match now works if it had not been seen
315before the match. I.e., this applies to C<${'&'}> (under C<no strict>) and
316C<eval '$&'>. The same applies to C<$'> and C<$`> [perl #4289].
317
a0e45bac
FC
318=item *
319
07a22236 320Several bugs involving C<local *ISA> and C<local *Foo::> causing stale
a0e45bac
FC
321MRO caches have been fixed.
322
139353f8
FC
323=item *
324
325Defining a subroutine when its typeglob has been aliased no longer results
326in stale method caches. This bug was introduced in Perl 5.10.
327
ba535ffe
FC
328=item *
329
330Localising a typeglob containing a subroutine when the typeglob's package
331has been deleted from its parent stash no longer produces an error. This
332bug was introduced in Perl 5.14.
333
52c09c59
FC
334=item *
335
336Under some circumstances, C<local *method=...> would fail to reset method
337caches upon scope exit.
338
12b847a2
FC
339=item *
340
341C</[.foo.]/> is no longer an error, but produces a warning (as before) and
342is treated as C</[.fo]/> [perl #115818].
343
6e50262c
FC
344=item *
345
346C<goto $tied_var> now calls FETCH before deciding what type of goto
347(subroutine or label) this is.
348
785fb813
FC
349=item *
350
351Renaming packages through glob assignment
352(C<*Foo:: = *Bar::; *Bar:: = *Baz::>) in combination with C<m?...?> and
353C<reset> no longer makes threaded builds crash.
354
f5778209
FC
355=item *
356
357An earlier release in the 5.17.x series could crash if user code prevented
358_charnames from loading via C<$INC{'_charnames.pm'}++>.
359
216cf7fc
DR
360=item *
361
362A number of bugs related to hash assignment have been fixed:
363
364=over 8
365
366=item
367
368The expression C<scalar(%h = (1, 1, 1, 1))> now returns C<4>, not C<2>.
369
370=item
371
372Perl now issues the same warning on C<($s, %h) = (1, {})> as it does for
373C<(%h) = ({})>, "Reference found where even-sized list expected".
374
375=item
376
377The return value of C<%h = (1, 1, 1)> (in list context was wrong. It would
378return I<just> those items instead of returning an additional C<undef> value
379for the missing value in the assignment.
380
381=back
382
e14ac59b
RS
383=back
384
916c45d9 385=head1 Acknowledgements
05bee12a 386
44691e6f
AB
387=head1 Reporting Bugs
388
e08634c5
SH
389If you find what you think is a bug, you might check the articles recently
390posted to the comp.lang.perl.misc newsgroup and the perl bug database at
391http://rt.perl.org/perlbug/ . There may also be information at
392http://www.perl.org/ , the Perl Home Page.
44691e6f 393
e08634c5
SH
394If you believe you have an unreported bug, please run the L<perlbug> program
395included with your release. Be sure to trim your bug down to a tiny but
396sufficient test case. Your bug report, along with the output of C<perl -V>,
397will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
44691e6f
AB
398
399If the bug you are reporting has security implications, which make it
e08634c5
SH
400inappropriate to send to a publicly archived mailing list, then please send it
401to perl5-security-report@perl.org. This points to a closed subscription
402unarchived mailing list, which includes all the core committers, who will be
403able to help assess the impact of issues, figure out a resolution, and help
f9001595 404co-ordinate the release of patches to mitigate or fix the problem across all
e08634c5
SH
405platforms on which Perl is supported. Please only use this address for
406security issues in the Perl core, not for modules independently distributed on
407CPAN.
44691e6f
AB
408
409=head1 SEE ALSO
410
e08634c5
SH
411The F<Changes> file for an explanation of how to view exhaustive details on
412what changed.
44691e6f
AB
413
414The F<INSTALL> file for how to build Perl.
415
416The F<README> file for general stuff.
417
418The F<Artistic> and F<Copying> files for copyright information.
419
420=cut