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