5 perldelta - what is new for perl v5.21.8
9 This document describes differences between the 5.21.7 release and the 5.21.8
12 If you are upgrading from an earlier release such as 5.21.6, first read
13 L<perl5217delta>, which describes differences between 5.21.6 and 5.21.7.
17 With this release we are now in the contentious changes portion of the code
18 freeze as we prepare for the next stable release of Perl 5.
20 =head1 Core Enhancements
22 =head2 The warnings pragma now supports warnings outside of "all"
24 Ever since perl v5.6.0 we've had no way of adding new warnings without
25 retroactively adding them to all existing programs that used C<-w>,
26 C<-W> or C<use warnings>.
28 This caused us to not add new useful warnings out of fear that they
29 might unduly burden users who just wanted to upgrade perl and didn't
30 want to deal with a bunch of warnings from their existing code.
32 We now support a way to have our cake and eat it too, and can add new
33 warnings to the core going forward through other top-level warning
34 categories. See L<the warnings documentation|warnings/Top-level
35 warning categories & associated confusion> for details.
37 =head2 Non-Capturing Regular Expression Flag
39 Regular expressions now support a C</n> flag that disables capturing
40 and filling in C<$1>, C<$2>, etc... inside of groups:
42 "hello" =~ /(hi|hello)/n; # $1 is not set
44 This is equivalent to putting C<?:> at the beginning of every capturing group.
46 See L<perlre/"n"> for more information.
48 =head2 C<prototype> with no arguments
50 C<prototype()> with no arguments now infers C<$_>. [perl #123514]
52 =head2 C<use re 'strict'>
54 This applies stricter syntax rules to regular expression patterns
55 compiled within its scope, which hopefully will alert you to typos and
56 other unintentional behavior that backwards-compatibility issues prevent
57 us from doing in normal regular expression compilations. Because the
58 behavior of this is subject to change in future Perl releases as we gain
59 experience, using this pragma will raise a category
60 C<experimental:re_strict> warning.
61 See L<'strict' in re|re/'strict' mode>.
63 =head2 New "const" subroutine attribute
65 The "const" attribute can be applied to an anonymous subroutine. It causes
66 it to be executed immediately when it is cloned. Its value is captured and
67 used to create a new constant subroutine that is returned. This feature is
68 experimental. See L<perlsub/Constant Functions>.
70 =head1 Incompatible Changes
72 =head2 sub signatures moved before attributes
74 The experimental sub signatures feature, as introduced in 5.20, parsed
75 signatures after attributes. In this release, the positioning has been
76 moved such that signatures occur in exactly the same positioning a
77 prototype would be found.
79 =head1 Modules and Pragmata
81 =head2 Updated Modules and Pragmata
87 L<arybase> has been upgraded from version 0.09 to 0.10.
91 L<attributes> has been upgraded from version 0.24 to 0.25.
93 Minor internal change only.
97 L<autodie> has been upgraded from version 2.25 to 2.26.
101 L<B> has been upgraded from version 1.54 to 1.55.
103 A bug where, after an ithread creation or psuedofork, special/immortal SVs in
104 the child ithread/psuedoprocess did not have the correct class of
105 C<B::SPECIAL>, has been fixed.
107 The C<id> and C<outid> PADLIST methods have been added.
111 L<B::Deparse> has been upgraded from version 1.31 to 1.32.
113 Deparsing C<BEGIN { undef &foo }> with the B<-w> switch enabled started to
114 emit 'uninitialized' warnings in Perl 5.14. This has been fixed.
116 Deparsing calls to subs with a C<(;+)> prototype resulted in an infinite
117 loop. The C<(;$>) C<(_)> and C<(;_)> prototypes were given the wrong
118 precedence, causing C<foo($aE<lt>$b)> to be deparsed without the parentheses.
122 L<Compress::Raw::Bzip2> has been upgraded from version 2.067 to 2.068.
126 L<Compress::Raw::Zlib> has been upgraded from version 2.067 to 2.068.
130 L<CPAN::Meta::Requirements> has been upgraded from version 2.130 to 2.131.
134 L<Data::Dumper> has been upgraded from version 2.155 to 2.156.
138 L<DB_File> has been upgraded from version 1.834 to 1.835.
142 L<Devel::Peek> has been upgraded from version 1.20 to 1.21.
146 L<Devel::PPPort> has been upgraded from version 3.25 to 3.28.
150 L<Digest::MD5> has been upgraded from version 2.53 to 2.54.
154 L<Digest::SHA> has been upgraded from version 5.93 to 5.95.
158 L<DynaLoader> has been upgraded from version 1.29 to 1.30.
162 L<ExtUtils::Command> has been upgraded from version 1.18 to 1.20.
166 L<ExtUtils::Manifest> has been upgraded from version 1.69 to 1.70.
170 L<File::Glob> has been upgraded from version 1.23 to 1.24.
172 Avoid SvIV() expanding to call get_sv() three times in a few
173 places. [perl #123606]
177 L<Filter::Util::Call> has been upgraded from version 1.51 to 1.54.
181 L<Getopt::Long> has been upgraded from version 2.42 to 2.43.
185 L<IO::Compress> has been upgraded from version 2.067 to 2.068.
189 L<IO::Socket::IP> has been upgraded from version 0.34 to 0.36.
193 L<MIME::Base64> has been upgraded from version 3.14 to 3.15.
197 L<Module::CoreList> has been upgraded from version 5.20141220 to 5.20150120.
201 L<Module::Load::Conditional> has been upgraded from version 0.62 to 0.64.
205 L<Module::Metadata> has been upgraded from version 1.000024 to 1.000026.
209 L<Opcode> has been upgraded from version 1.30 to 1.31.
213 L<PerlIO::encoding> has been upgraded from version 0.20 to 0.21.
217 L<Pod::Simple> has been upgraded from version 3.28 to 3.29.
221 L<POSIX> has been upgraded from version 1.48 to 1.49.
225 L<re> has been upgraded from version 0.28 to 0.30.
229 L<Safe> has been upgraded from version 2.38 to 2.39.
231 C<reval> was not propagating void context properly.
235 L<SDBM_File> has been upgraded from version 1.12 to 1.13.
237 Simplified the build process. [perl #123413]
241 L<Test::Harness> has been upgraded from version 3.34 to 3.35.
245 L<Test::Simple> has been upgraded from version 1.301001_090 to 1.301001_097.
249 L<Unicode::Collate> has been upgraded from version 1.09 to 1.10.
253 L<VMS::DCLsym> has been upgraded from version 1.05 to 1.06.
257 L<warnings> has been upgraded from version 1.29 to 1.30.
263 =head2 New Documentation
265 =head3 L<perlunicook>
267 This document, by Tom Christiansen, provides examples of handling Unicode in
272 The following additions or changes have been made to diagnostic output,
273 including warnings and fatal error messages. For the complete list of
274 diagnostic messages, see L<perldiag>.
276 =head2 New Diagnostics
284 L<Bad symbol for scalar|perldiag/"Bad symbol for scalar">
286 (P) An internal request asked to add a scalar entry to something that
287 wasn't a symbol table entry.
291 L<:const is not permitted on named subroutines|perldiag/":const is not permitted on named subroutines">
293 (F) The "const" attribute causes an anonymous subroutine to be run and
294 its value captured at the time that it is cloned. Names subroutines are
295 not cloned like this, so the attribute does not make sense on them.
305 L<:const is experimental|perldiag/":const is experimental">
307 (S experimental::const_attr) The "const" attribute is experimental.
308 If you want to use the feature, disable the warning with C<no warnings
309 'experimental::const_attr'>, but know that in doing so you are taking
310 the risk that your code may break in a future Perl version.
314 L<Non-finite repeat count does nothing|perldiag/"Non-finite repeat count does nothing">
316 (W numeric) You tried to execute the
317 L<C<x>|perlop/Multiplicative Operators> repetition operator C<Inf> (or
318 C<-Inf>) or C<NaN> times, which doesn't make sense.
322 L<Useless use of attribute "const"|perldiag/Useless use of attribute "const">
324 (W misc) The "const" attribute has no effect except
325 on anonymous closure prototypes. You applied it to
326 a subroutine via L<attributes.pm|attributes>. This is only useful
327 inside an attribute handler for an anonymous subroutine.
331 L<Unusual use of %s in void context|perldiag/"Unusual use of %s in void context">
333 (W void_unusual) Similar to the "Useless use of %s in void context"
334 warning, but only turned on by the top-level "pedantic" warning
335 category, used for e.g. C<grep> in void context, which may indicate a
336 bug, but could also just be someone using C<grep> for its side-effects
339 Enabled as part of "extra" warnings, not in the "all" category. See
340 L<warnings> for details
344 L<E<quot>use re 'strict'E<quot> is experimental|perldiag/"use re 'strict'" is experimental>
346 (S experimental::re_strict) The things that are different when a regular
347 expression pattern is compiled under C<'strict'> are subject to change
348 in future Perl releases in incompatible ways. This means that a pattern
349 that compiles today may not in a future Perl release. This warning is
350 to alert you to that risk.
352 L<Wide character (U+%X) in %s|perldiag/"Wide character (U+%X) in %s">
354 (W locale) While in a single-byte locale (I<i.e.>, a non-UTF-8
355 one), a multi-byte character was encountered. Perl considers this
356 character to be the specified Unicode code point. Combining non-UTF8
357 locales and Unicode is dangerous. Almost certainly some characters
358 will have two different representations. For example, in the ISO 8859-7
359 (Greek) locale, the code point 0xC3 represents a Capital Gamma. But so
360 also does 0x393. This will make string comparisons unreliable.
362 You likely need to figure out how this multi-byte character got mixed up
363 with your single-byte locale (or perhaps you thought you had a UTF-8
364 locale, but Perl disagrees).
368 L<Both or neither range ends should be Unicode in regex; marked by E<lt>-- HERE in mE<sol>%sE<sol>|perldiag/"Both or neither range ends should be Unicode in regex; marked by <-- HERE in m/%s/">
370 (W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
372 In a bracketed character class in a regular expression pattern, you
373 had a range which has exactly one end of it specified using C<\N{}>, and
374 the other end is specified using a non-portable mechanism. Perl treats
375 the range as a Unicode range, that is, all the characters in it are
376 considered to be the Unicode characters, and which may be different code
377 points on some platforms Perl runs on. For example, C<[\N{U+06}-\x08]>
378 is treated as if you had instead said C<[\N{U+06}-\N{U+08}]>, that is it
379 matches the characters whose code points in Unicode are 6, 7, and 8.
380 But that C<\x08> might indicate that you meant something different, so
381 the warning gets raised.
385 L<Ranges of ASCII printables should be some subset of "0-9", "A-Z", or "a-z" in regex; marked by E<lt>-- HERE in mE<sol>%sE<sol>|perldiag/"Ranges of ASCII printables should be some subset of "0-9", "A-Z", or "a-z" in regex; marked by <-- HERE in mE<sol>%sE<sol>">
387 (W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
389 Stricter rules help to find typos and other errors. Perhaps you didn't
390 even intend a range here, if the C<"-"> was meant to be some other
391 character, or should have been escaped (like C<"\-">). If you did
392 intend a range, the one that was used is not portable between ASCII and
393 EBCDIC platforms, and doesn't have an obvious meaning to a casual
396 [3-7] # OK; Obvious and portable
397 [d-g] # OK; Obvious and portable
398 [A-Y] # OK; Obvious and portable
399 [A-z] # WRONG; Not portable; not clear what is meant
400 [a-Z] # WRONG; Not portable; not clear what is meant
401 [%-.] # WRONG; Not portable; not clear what is meant
402 [\x41-Z] # WRONG; Not portable; not obvious to non-geek
404 (You can force portability by specifying a Unicode range, which means that
405 the endpoints are specified by
406 L<C<\N{...}>|perlrecharclass/Character Ranges>, but the meaning may
407 still not be obvious.)
408 The stricter rules require that ranges that start or stop with an ASCII
409 character that is not a control have all their endpoints be the literal
410 character, and not some escape sequence (like C<"\x41">), and the ranges
411 must be all digits, or all uppercase letters, or all lowercase letters.
415 L<Ranges of digits should be from the same group in regex; marked by E<lt>-- HERE in mE<sol>%sE<sol>|perldiag/"Ranges of digits should be from the same group in regex; marked by <-- HERE in m/%s/">
417 (W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
419 Stricter rules help to find typos and other errors. You included a
420 range, and at least one of the end points is a decimal digit. Under the
421 stricter rules, when this happens, both end points should be digits in
422 the same group of 10 consecutive digits.
426 L<"%s" is more clearly written simply as "%s" in regex; marked by E<lt>-- HERE in mE<sol>%sE<sol>|perldiag/"%s" is more clearly written simply as "%s" in regex; marked by <-- HERE in mE<sol>%sE<sol>>
428 (W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
430 You specified a character that has the given plainer way of writing it,
431 and which is also portable to platforms running with different character
436 =head2 Changes to Existing Diagnostics
443 L<Locale '%s' may not work well.%s|perldiag/"Locale '%s' may not work well.%s">
444 is no longer raised unless the problemtatic locale is actually used in
445 the Perl program. Previously it was raised if it merely was the
446 underlying locale. All Perl programs have an underlying locale at all
447 times, but something like a C<S<use locale>> is needed for that locale
448 to actually have some effect. This message will not be raised when
449 the underlying locale is hidden.
453 =head1 Configuration and Compilation
459 pthreads and lcl will be linked by default if present. This allows XS modules
460 that require threading to work on non-threaded perls. Note that you must still
461 pass C<-Dusethreads> if you want a threaded perl.
471 A new test script, F<bigmem/subst.t>, has been added to test memory usage of
472 subst on very large strings.
476 A new test script, F<op/anonconst.t>, has been added to test experimental
481 A new test script, F<re/reg_nocapture.t>, has been added to test the new
486 =head1 Platform Support
488 =head2 Platform-Specific Notes
498 Previously, on Visual C++ for Win64 built Perls only, when compiling every Perl
499 XS module (including CPAN ones) and Perl aware .c file with a 64 bit Visual C++,
500 would unconditionally have around a dozen warnings from hv_func.h. These
501 warnings have been silenced. GCC all bitness and Visual C++ for Win32 were
506 Support for building without PerlIO has been removed from the Windows
507 makefiles. Non-PerlIO builds were all but deprecated in Perl 5.18.0 and are
508 already not supported by F<Configure> on POSIX systems.
512 Between 2 and 6 ms and 7 I/O calls have been saved per attempt to open a perl
513 module for each path in C<@INC>.
519 =head1 Internal Changes
525 Added Perl_sv_get_backrefs() to determine if an SV is a weak-referent.
527 Function either returns an SV * of type AV, which contains the set of
528 weakreferences which reference the passed in SV, or a simple RV * which
529 is the only weakref to this item.
533 =head1 Selected Bug Fixes
539 A bug in regular expression patterns that could lead to segfaults and
540 other crashes has been fixed. This occurred only in patterns compiled
541 with C<"/i">, while taking into account the current POSIX locale (this usually
542 means they have to be compiled within the scope of C<S<"use locale">>),
543 and there must be a string of at least 128 consecutive bytes to match.
548 C<s///> now works on very long strings instead of dying with 'Substitution
549 loop'. [perl #103260] [perl #123071]
553 C<gmtime> no longer crashes with not-a-number values. [perl #123495]
557 C<\()> (reference to an empty list) and C<y///> with lexical $_ in scope
558 could do a bad write past the end of the stack. They have been fixed
559 to extend the stack first.
563 C<prototype()> with no arguments used to read the previous item on the
564 stack, so C<print "foo", prototype()> would print foo's prototype. It has
565 been fixed to infer $_ instead. [perl #123514]
569 Some cases of lexical state subs inside predeclared subs could crash but no
574 Some cases of nested lexical state subs inside anonymous subs could cause
575 'Bizarre copy' errors or possibly even crash.
579 When trying to emit warnings, perl's default debugger (F<perl5db.pl>) was
580 sometimes giving 'Undefined subroutine &DB::db_warn called' instead. This
581 bug, which started to occur in Perl 5.18, has been fixed. [perl #123553]
585 Certain syntax errors in substitutions, such as C<< s/${E<lt>E<gt>{})// >>, would
586 crash, and had done so since Perl 5.10. (In some cases the crash did not
587 start happening till 5.16.) The crash has, of course, been fixed.
592 A repeat expression like C<33 x ~3> could cause a large buffer
593 overflow since the new output buffer size was not correctly handled by
594 SvGROW(). An expression like this now properly produces a memory wrap
599 C<< formline("@...", "a"); >> would crash. The C<FF_CHECKNL> case in
600 pp_formline() didn't set the pointer used to mark the chop position,
601 which led to the C<FF_MORE> case crashing with a segmentation fault.
602 This has been fixed. [perl #123538]
606 =head1 Acknowledgements
608 Perl 5.21.8 represents approximately 4 weeks of development since Perl 5.21.7
609 and contains approximately 26,000 lines of changes across 750 files from 27
612 Excluding auto-generated files, documentation and release tools, there were
613 approximately 13,000 lines of changes to 410 .pm, .t, .c and .h files.
615 Perl continues to flourish into its third decade thanks to a vibrant community
616 of users and developers. The following people are known to have contributed the
617 improvements that became Perl 5.21.8:
619 Aaron Crane, Andreas Voegele, Chad Granum, Chris 'BinGOs' Williams, Craig A.
620 Berry, Daniel Dragan, David Mitchell, E. Choroba, Ed J, Father Chrysostomos,
621 H.Merijn Brand, Hugo van der Sanden, James E Keenan, Jarkko Hietaniemi, Karen
622 Etheridge, Karl Williamson, Matthew Horsfall, Max Maischein, Peter Martini,
623 Rafael Garcia-Suarez, Ricardo Signes, Rostislav Skudnov, Slaven Rezic, Steve
624 Hay, Tony Cook, Yves Orton, Ævar Arnfjörð Bjarmason.
626 The list above is almost certainly incomplete as it is automatically generated
627 from version control history. In particular, it does not include the names of
628 the (very much appreciated) contributors who reported issues to the Perl bug
631 Many of the changes included in this version originated in the CPAN modules
632 included in Perl's core. We're grateful to the entire CPAN community for
633 helping Perl to flourish.
635 For a more complete list of all of Perl's historical contributors, please see
636 the F<AUTHORS> file in the Perl source distribution.
638 =head1 Reporting Bugs
640 If you find what you think is a bug, you might check the articles recently
641 posted to the comp.lang.perl.misc newsgroup and the perl bug database at
642 https://rt.perl.org/ . There may also be information at
643 http://www.perl.org/ , the Perl Home Page.
645 If you believe you have an unreported bug, please run the L<perlbug> program
646 included with your release. Be sure to trim your bug down to a tiny but
647 sufficient test case. Your bug report, along with the output of C<perl -V>,
648 will be sent off to perlbug@perl.org to be analysed by the Perl porting team.
650 If the bug you are reporting has security implications, which make it
651 inappropriate to send to a publicly archived mailing list, then please send it
652 to perl5-security-report@perl.org. This points to a closed subscription
653 unarchived mailing list, which includes all the core committers, who will be
654 able to help assess the impact of issues, figure out a resolution, and help
655 co-ordinate the release of patches to mitigate or fix the problem across all
656 platforms on which Perl is supported. Please only use this address for
657 security issues in the Perl core, not for modules independently distributed on
662 The F<Changes> file for an explanation of how to view exhaustive details on
665 The F<INSTALL> file for how to build Perl.
667 The F<README> file for general stuff.
669 The F<Artistic> and F<Copying> files for copyright information.