This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PL_sv_objcount deprecation notice
[perl5.git] / pod / perl5172delta.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 perl5172delta - what is new for perl v5.17.2
6
7 =head1 DESCRIPTION
8
9 This document describes differences between the 5.17.1 release and
10 the 5.17.2 release.
11
12 If you are upgrading from an earlier release such as 5.17.0, first read
13 L<perl5171delta>, which describes differences between 5.17.0 and
14 5.17.1.
15
16 =head1 Core Enhancements
17
18 =head2 C<kill> with negative signal names
19
20 C<kill> has always allowed a negative signal number, which kills the
21 process group instead of a single process.  It has also allowed signal
22 names.  But it did not behave consistently, because negative signal names
23 were treated as 0.  Now negative signals names like C<-INT> are supported
24 and treated the same way as -2 [perl #112990].
25
26 =head2 C<pack> is now constant folded.
27
28 C<pack> with constant arguments is now constant folded in most cases
29 [perl #113470].
30
31 =head1 Modules and Pragmata
32
33 =head2 Updated Modules and Pragmata
34
35 =over 4
36
37 =item *
38
39 L<File::stat> has been upgraded from version 1.06 to 1.07.
40
41 Previously C<File::stat>'s overloaded C<-x> and C<-X> operators did not give
42 the correct results for directories or executable files when running as
43 root. They had been treating executable permissions for root just like for
44 any other user, performing group membership tests I<etc> for files not owned
45 by root. They now follow the correct Unix behaviour - for a directory they
46 are always true, and for a file if any of the three execute permission bits
47 are set then they report that root can execute the file. Perl's builtin
48 C<-x> and C<-X> operators have always been correct.
49
50 =item *
51
52 L<Tie::StdHandle> has been upgraded from version 4.2 to 4.3.
53
54 C<READ> now respects the offset argument to C<read> [perl #112826].
55
56 =item *
57
58 L<IO> has been upgraded from version 1.25_07 to 1.25_08.
59
60 L<IO::Socket> tries harder to cache or otherwise fetch socket
61 information.
62
63 =item *
64
65 L<Storable> has been upgraded from version 2.36 to 2.37.
66
67 Restricted hashes were not always thawed correctly [perl #73972].
68
69 Storable would croak when freezing a blessed REF object with a
70 C<STORABLE_freeze()> method [perl #113880].
71
72 =item *
73
74 L<Socket> has been upgraded from version 2.001 to 2.002.
75
76 =item *
77
78 L<autodie> has been upgraded from version 2.11 to 2.12.
79
80 C<autodie> now plays nicely with the 'open' pragma.
81
82 =item *
83
84 L<File::Fetch> has been upgraded from version 0.34 to 0.36.
85
86 Added the 'file_default' option for URLs that do not have a file
87 component.
88
89 =item *
90
91 L<Module::CoreList> has been upgraded from version 2.68 to 2.69.
92
93 =back
94
95 =head1 Documentation
96
97 =head2 Changes to Existing Documentation
98
99 =head3 L<perlfunc>
100
101 =over 4
102
103 =item *
104
105 Clarified documentation of C<our>.
106
107 =back
108
109 =head1 Diagnostics
110
111 The following additions or changes have been made to diagnostic output,
112 including warnings and fatal error messages.  For the complete list of
113 diagnostic messages, see L<perldiag>.
114
115 =head2 New Diagnostics
116
117 =head3 New Errors
118
119 =over 4
120
121 =item *
122
123 L<Group name must start with a non-digit word character in regex; marked by <-- HERE in mE<sol>%sE<sol>|perldiag/"Group name must start with a non-digit word character in regex; marked by <-- HERE in m/%s/">
124
125 This error has been added for C<(?&0)>, which is invalid.  It used to
126 produce an incomprehensible error message [perl #101666].
127
128 =item *
129
130 L<Can't use an undefined value as a subroutine reference|perldiag/"Can't use an undefined value as %s reference">
131
132 Calling an undefined value as a subroutine now produces this error message.
133 It used to, but was accidentally disabled, first in Perl 5.004 for
134 non-magical variables, and then in Perl 5.14 for magical (e.g., tied)
135 variables.  It has now been restored.  In the mean time, undef was treated
136 as an empty string [perl #113576].
137
138 =back
139
140 =head3 New Warnings
141
142 =over 4
143
144 =item *
145
146 "L<Invalid negative number (%s) in chr|perldiag/"Invalid negative number (%s) in chr">"
147
148 C<chr()> now warns when passed a negative value [perl #83048].
149
150 =item *
151
152 "L<Integer overflow in srand|perldiag/"Integer overflow in srand">"
153
154 C<srand()> now warns when passed a value that doesn't fit in a C<UV> (since the
155 value will be truncated rather than overflowing) [perl #40605].
156
157 =item *
158
159 "L<-i used with no filenames on the command line, reading from STDIN|perldiag/"-i used with no filenames on the command line, reading from STDIN">"
160
161 Running perl with the C<-i> flag now warns if no input files are provided on
162 the command line [perl #113410].
163
164 =back
165
166 =head2 Changes to Existing Diagnostics
167
168 =over 4
169
170 =item *
171
172 The 'Can't use "my %s" in sort comparison' error has been downgraded to a
173 warning, '"my %s" used in sort comparison' (with 'state' instead of 'my'
174 for state variables).  In addition, the heuristics for guessing whether
175 lexical $a or $b has been misused have been improved to generate fewer
176 false positives.  Lexical $a and $b are no longer disallowed if they are
177 outside the sort block.  Also, a named unary or list operator inside the
178 sort block no longer causes the $a or $b to be ignored [perl #86136].
179
180 =back
181
182 =head1 Configuration and Compilation
183
184 =over 4
185
186 =item *
187
188 Building perl with some Windows compilers used to fail due to a problem
189 with miniperl's C<glob> operator (which uses the C<perlglob> program)
190 deleting the PATH environment variable [perl #113798].
191
192 =back
193
194 =head1 Platform Support
195
196 =head2 Platform-Specific Notes
197
198 =over 4
199
200 =item VMS
201
202 Quotes are now removed from the command verb (but not the parameters) for commands
203 spawned via C<system>, backticks, or a piped C<open>.  Previously, quotes on the verb 
204 were passed through to DCL, which would fail to recognize the command.  Also, if the
205 verb is actually a path to an image or command procedure on an ODS-5 volume, quoting it
206 now allows the path to contain spaces.
207
208 =item AIX
209
210 Configure now always adds C<-qlanglvl=extc99> to the CC flags on AIX when
211 using xlC.  This will make it easier to compile a number of XS-based modules
212 that assume C99 [perl #113778].
213
214 =back
215
216 =head1 Internal Changes
217
218 =over 4
219
220 =item *
221
222 Perl used to implement get magic in a way that would sometimes hide bugs in
223 code could call mg_get() too many times on magical values.  This hiding of
224 errors no longer occurs, so long-standing bugs may become visible now.  If
225 you see magic-related errors in XS code, check to make sure it, together
226 with the Perl API functions it uses, calls mg_get() only once on SvGMAGICAL()
227 values.
228
229 =item *
230
231 OP allocation for CVs now uses a slab allocator.  This simplifies
232 memory management for OPs allocated to a CV, so cleaning up after a
233 compilation error is simpler and safer [perl #111462][perl #112312].
234
235 =item *
236
237 PERL_DEBUG_READONLY_OPS has been rewritten to work with the new slab
238 allocator, allowing it to catch more violations than before.
239
240 =item *
241
242 The old slab allocator for ops, which was only enabled for PERL_IMPLICIT_SYS and PERL_DEBUG_READONLY_OPS, has been retired.
243
244 =back
245
246 =head1 Selected Bug Fixes
247
248 =over 4
249
250 =item *
251
252 A regression introduced in v5.14.0 has been fixed, in which some calls
253 to the C<re> module would clobber C<$_> [perl #113750].
254
255 =item *
256
257 C<do FILE> now always either sets or clears C<$@>, even when the file can't be
258 read. This ensures that testing C<$@> first (as recommended by the
259 documentation) always returns the correct result.
260
261 =item *
262
263 The array iterator used for the C<each @array> construct is now correctly
264 reset when C<@array> is cleared (RT #75596). This happens for example when the
265 array is globally assigned to, as in C<@array = (...)>, but not when its
266 B<values> are assigned to. In terms of the XS API, it means that C<av_clear()>
267 will now reset the iterator.
268
269 This mirrors the behaviour of the hash iterator when the hash is cleared.
270
271 =item *
272
273 C<< $class->can >>, C<< $class->isa >>, and C<< $class->DOES >> now return
274 correct results, regardless of whether that package referred to by C<$class>
275 exists [perl #47113].
276
277 =item *
278
279 Arriving signals no longer clear C<$@> [perl #45173].
280
281 =item *
282
283 Allow C<my ()> declarations with an empty variable list [perl #113554].
284
285 =item *
286
287 During parsing, subs declared after errors no longer leave stubs
288 [perl #113712].
289
290 =item *
291
292 Closures containing no string evals no longer hang on to their containing
293 subroutines, allowing variables closed over by outer subroutines to be
294 freed when the outer sub is freed, even if the inner sub still exists
295 [perl #89544].
296
297 =item *
298
299 Duplication of in-memory filehandles by opening with a "<&=" or ">&=" mode
300 stopped working properly in 5.16.0.  It was causing the new handle to
301 reference a different scalar variable.  This has been fixed [perl #113764].
302
303 =item *
304
305 C<qr//> expressions no longer crash with custom regular expression engines
306 that do not set C<offs> at regular expression compilation time
307 [perl #112962].
308
309 =item *
310
311 C<delete local> no longer crashes with certain magical arrays and hashes
312 [perl #112966].
313
314 =item *
315
316 C<local> on elements of certain magical arrays and hashes used not to
317 arrange to have the element deleted on scope exit, even if the element did
318 not exist before C<local>.
319
320 =item *
321
322 C<scalar(write)> no longer returns multiple items [perl #73690].
323
324 =item *
325
326 String to floating point conversions no longer misparse certain strings under
327 C<use locale> [perl #109318].
328
329 =item *
330
331 C<@INC> filters that die no longer leak memory [perl #92252].
332
333 =item *
334
335 The implementations of overloaded operations are now called in the correct
336 context. This allows, among other things, being able to properly override
337 C<< <> >> [perl #47119].
338
339 =item *
340
341 Specifying only the C<fallback> key when calling C<use overload> now behaves
342 properly [perl #113010].
343
344 =item *
345
346 C<< sub foo { my $a = 0; while ($a) { ... } } >> and
347 C<< sub foo { while (0) { ... } } >> now return the same thing [perl #73618].
348
349 =item *
350
351 Fixed the debugger C<l> and C<M> commands, and other debugger
352 functionality which was broken in 5.17.0 [perl #113918].
353
354 =item *
355
356 String negation now behaves the same under C<use integer;> as it does
357 without [perl #113012].
358
359 =item *
360
361 C<chr> now returns the Unicode replacement character (U+FFFD) for -1,
362 regardless of the internal representation.  -1 used to wrap if the argument
363 was tied or a string internally.
364
365 =item *
366
367 Using a C<format> after its enclosing sub was freed could crash as of
368 perl 5.12.0, if the format referenced lexical variables from the outer sub.
369
370 =item *
371
372 Using a C<format> after its enclosing sub was undefined could crash as of
373 perl 5.10.0, if the format referenced lexical variables from the outer sub.
374
375 =item *
376
377 Using a C<format> defined inside a closures, which format references
378 lexical variables from outside, never really worked unless the C<write>
379 call was directly inside the closure.  In 5.10.0 it even started crashing.
380 Now the copy of that closure nearest the top of the call stack is used to
381 find those variables.
382
383 =item *
384
385 Formats that close over variables in special blocks no longer crash if a
386 stub exists with the same name as the special block before the special
387 block is compiled.
388
389 =item *
390
391 The parser no longer gets confused, treating C<eval foo ()> as a syntax
392 error if preceded by C<print;> [perl #16249].
393
394 =item *
395
396 The return value of C<syscall> is no longer truncated on 64-bit platforms
397 [perl #113980].
398
399 =item *
400
401 Constant folding no longer causes C<print 1 ? FOO : BAR> to print to the
402 FOO handle [perl #78064].
403
404 =item *
405
406 C<do subname> now calls the named subroutine and uses the file name it
407 returns, instead of opening a file named "subname".
408
409 =item *
410
411 Subroutines looked up by rv2cv check hooks (registered by XS modules) are
412 now taken into consideration when determining whether C<foo bar> should be
413 the sub call C<foo(bar)> or the method call C<< "bar"->foo >>.
414
415 =item *
416
417 C<CORE::foo::bar> is no longer treated specially, allowing global overrides
418 to be called directly via C<CORE::GLOBAL::uc(...)> [perl #113016].
419
420 =item *
421
422 Calling an undefined sub whose typeglob has been undefined now produces the
423 customary "Undefined subroutine called" error, instead of "Not a CODE
424 reference".
425
426 =item *
427
428 Two bugs involving @ISA have been fixed.  C<*ISA = *glob_without_array> and
429 C<undef *ISA; @{*ISA}> would prevent future modifications to @ISA from
430 updating the internal caches used to look up methods.  The
431 *glob_without_array case was a regression from Perl 5.12.
432
433 =item *
434
435 Regular expression optimisations sometimes caused C<$> with C</m> to
436 produce failed or incorrect matches [perl #114068].
437
438 =item *
439
440 C<__SUB__> now works in a C<sort> block when the enclosing subroutine is
441 predeclared with C<sub foo;> syntax [perl #113710].
442
443 =item *
444
445 Unicode properties only apply to Unicode code points, which leads to
446 some subtleties when regular expressions are matched against
447 above-Unicode code points.  There is a warning generated to draw your
448 attention to this.  However, this warning was being generated
449 inappropriately in some cases, such as when a program was being parsed.
450 Non-Unicode matches such as C<\w> and C<[:word;]> should not generate the
451 warning, as their definitions don't limit them to apply to only Unicode
452 code points.  Now the message is only generated when matching against
453 C<\p{}> and C<\P{}>.  There remains a bug, [perl #114148], for the very
454 few properties in Unicode that match just a single code point.  The
455 warning is not generated if they are matched against an above-Unicode
456 code point.
457
458 =back
459
460 =head1 Acknowledgements
461
462 Perl 5.17.2 represents approximately 4 weeks of development since Perl 5.17.1
463 and contains approximately 15,000 lines of changes across 320 files from 34
464 authors.
465
466 Perl continues to flourish into its third decade thanks to a vibrant community
467 of users and developers. The following people are known to have contributed the
468 improvements that became Perl 5.17.2:
469
470 Aristotle Pagaltzis, Brian Fraser, Chip Salzenberg, Chris 'BinGOs' Williams,
471 Colin Kuskie, Craig A. Berry, Daniel Dragan, Daniel Perrett, Darin McBride,
472 David Golden, David Mitchell, Dominic Hargreaves, E. Choroba, Eric Brine,
473 Father Chrysostomos, François Perrad, H.Merijn Brand, Jan Dubois, Jesse
474 Luehrs, Karl Williamson, Lukas Mai, Matthew Horsfall, Nicholas Clark, Oleg
475 Nesterov, Reini Urban, Ricardo Signes, Robin Barker, Shirakata Kentaro, Shlomi
476 Fish, Steve Hay, Tony Cook, Vincent Pit, Walt Mankowski, Yves Orton.
477
478 The list above is almost certainly incomplete as it is automatically generated
479 from version control history. In particular, it does not include the names of
480 the (very much appreciated) contributors who reported issues to the Perl bug
481 tracker.
482
483 Many of the changes included in this version originated in the CPAN modules
484 included in Perl's core. We're grateful to the entire CPAN community for
485 helping Perl to flourish.
486
487 For a more complete list of all of Perl's historical contributors, please see
488 the F<AUTHORS> file in the Perl source distribution.
489
490 =head1 Reporting Bugs
491
492 If you find what you think is a bug, you might check the articles
493 recently posted to the comp.lang.perl.misc newsgroup and the perl
494 bug database at http://rt.perl.org/perlbug/ .  There may also be
495 information at http://www.perl.org/ , the Perl Home Page.
496
497 If you believe you have an unreported bug, please run the L<perlbug>
498 program included with your release.  Be sure to trim your bug down
499 to a tiny but sufficient test case.  Your bug report, along with the
500 output of C<perl -V>, will be sent off to perlbug@perl.org to be
501 analysed by the Perl porting team.
502
503 If the bug you are reporting has security implications, which make it
504 inappropriate to send to a publicly archived mailing list, then please send
505 it to perl5-security-report@perl.org. This points to a closed subscription
506 unarchived mailing list, which includes
507 all the core committers, who will be able
508 to help assess the impact of issues, figure out a resolution, and help
509 co-ordinate the release of patches to mitigate or fix the problem across all
510 platforms on which Perl is supported. Please only use this address for
511 security issues in the Perl core, not for modules independently
512 distributed on CPAN.
513
514 =head1 SEE ALSO
515
516 The F<Changes> file for an explanation of how to view exhaustive details
517 on what changed.
518
519 The F<INSTALL> file for how to build Perl.
520
521 The F<README> file for general stuff.
522
523 The F<Artistic> and F<Copying> files for copyright information.
524
525 =cut