In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/90ed3b64f9d043d7ca1192211783b7b575da5d55?hp=dfaac8d7d0cc16e070ecc441ab1f1ffeda3b7563>
- Log ----------------------------------------------------------------- commit 90ed3b64f9d043d7ca1192211783b7b575da5d55 Author: Ãvar Arnfjörð Bjarmason <[email protected]> Date: Tue May 16 18:30:10 2017 +0000 perldelta: clarify what '.' and @INC is about The existing section we had here was totally misleading. I couldn't understand "now provides a way to build" and "if you want it turn X on" differently than meaning that '.' was still in @INC by default and you had to compile perl with some optional switch to turn it on. It turns out[1] that the exact opposite of that is the case. This is on by default. Rewrite the entire section to make that clear to the reader. While I'm at it dumb it down a bit to be understandable to someone who's just upgrading Perl. Not everyone knows what @INC is offhand, but describing how we now load libraries is understandable to everyone. Then cover PERL_USE_UNSAFE_INC=1 and how it's set by various toolchain modules now, and finally avoid talking about both DEFAULT_INC_EXCLUDES_DOT and -Ddefault_inc_excludes_dot in the context of a build option, just consistently mention only -Ddefault_inc_excludes_dot. We could go into much more detail here. See the "[RFC] We need prose for perl526delta about "." in @INC removal" thread[2]. I think including something like that probably makes sense later in the document, but this should suffice for an intro section, and I'll let others who proposed more detailed updates send their own patches for further clarifying this feature. 1. "Re: Perl 5.26.0-RC1 is now available!" (<CAATnKFABh0PjQK0WLqC-MTugj==o22zjwrgdapfb1ehvlr0...@mail.gmail.com>" 2. <CAATnKFCSeGh6Lcwux1CsGP=6pQSQtG7_bViZRGji3Soa5b=1...@mail.gmail.com> (http://www.nntp.perl.org/group/perl.perl5.porters/2017/03/msg243763.html) M pod/perldelta.pod commit d053832c03579dcc400e433bc6d23d5975989800 Author: Ãvar Arnfjörð Bjarmason <[email protected]> Date: Sat May 13 22:14:50 2017 +0000 perldelta: clarify how undeffing HV/AV is faster now There were better notes in the change that introduced this[1]. Copy the performance numbers from there, and say "arrays and hashes". instead of "AV and HV". Better to use the more familiar names than the internal struct names which are mostly only familiar to core devs. 1. be98855787 ("speed up AV and HV clearing/undeffing", 2016-10-26) M pod/perldelta.pod commit 9501343148697ec8e98e1c00630f54cf7d351a56 Author: Yves Orton <[email protected]> Date: Sat May 13 22:00:15 2017 +0000 perldelta: clarify what these new capture variables are for [Ãvar: I originally had a worse patch for this, but Yves had a better one to fixup into mine. See "Re: Perl 5.26.0-RC1 is now available!"[1] on list for context.]. 1. <CANgJU+Uh0Kg_fS=3ux5wvztskocoqt2gjvy8tgyhjctd0-d...@mail.gmail.com> M pod/perldelta.pod M pod/perlvar.pod commit b4ed7b96540cdd76abceb626c939980a262b1252 Author: Ãvar Arnfjörð Bjarmason <[email protected]> Date: Sat May 13 21:56:19 2017 +0000 perldelta: move the note about utf8_hop() to the bottom A note about a relatively obscure internal API function really doesn't belong so high up in the "Core Enhancements", before core visible user changes. Move this to the bottom, all of the other things in this section are things normal Perl programmers might actually use/encounter/care about, whereas this change is only relevant for some XS maintainers. M pod/perldelta.pod commit e15b68a6298595233f8324e720483bc326f55fc0 Author: Ãvar Arnfjörð Bjarmason <[email protected]> Date: Sat May 13 21:46:43 2017 +0000 perldelta: remove "maybe this won't be in 5.26" note about PERL_USE_UNSAFE_INC This was originally added in commit 8bbdbfcb89 ("Perldelta updates in prep for tomorrows release", 2016-11-19), we're now at RC1 so it's pretty clear that this will be in the release. M pod/perldelta.pod commit 2586f92ec5d42019ea7f1b541a27c8ad1d41636a Author: Ãvar Arnfjörð Bjarmason <[email protected]> Date: Sat May 13 22:06:44 2017 +0000 perldelta: mention when lexical_subs were introduced Doesn't take up much space, and makes you aware that if you e.g. are using 5.18 already you can now use this in all your code without fear. M pod/perldelta.pod commit a9fbda477bd823a07867e25b8c4a732eb666070f Author: Ãvar Arnfjörð Bjarmason <[email protected]> Date: Sat May 13 22:01:51 2017 +0000 perldelta: 'for slightly more detail' -> 'for more details' There's no need to inject "slightly" there, that documentation section looks pretty complete to me. M pod/perldelta.pod commit 21f25801eb169a8c56dd9c6da283cff88bed4638 Author: Ãvar Arnfjörð Bjarmason <[email protected]> Date: Sat May 13 21:41:54 2017 +0000 perldelta: grammar fix: "[process] do not function well" -> "does not ..." M pod/perldelta.pod ----------------------------------------------------------------------- Summary of changes: pod/perldelta.pod | 77 +++++++++++++++++++++++++++++++++++++++---------------- pod/perlvar.pod | 7 +++-- 2 files changed, 60 insertions(+), 24 deletions(-) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index ed13834024..e7b2cc208b 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -64,30 +64,42 @@ prints "Hello there\n" with no leading whitespace. =head2 '.' and @INC -Perl now provides a way to build perl without C<.> in @INC by default. If you -want this feature, you can build with -Ddefault_inc_excludes_dot - -Because the testing / make process for perl modules do not function well with -C<.> missing from @INC, Perl now supports the environment variable -PERL_USE_UNSAFE_INC=1 which makes Perl behave as it previously did, returning -C<.> to @INC in all child processes. - -WARNING: C<PERL_USE_UNSAFE_INC> has been provided during the perl 5.25 -development cycle and is not guaranteed to function in perl 5.26. - -=head2 create a safer utf8_hop() called utf8_hop_safe() - -Unlike utf8_hop(), utf8_hop_safe() won't navigate before the beginning or after -the end of the supplied buffer. +Since time immemorial Perl has, as a last resort, loaded libraries +from the current directory. For security reasons this is no longer the +case, the C<@INC> variable no longer contains C<.> as its last element +by default. + +If you want to disable this behavior at compile-time build perl with +C<-Udefault_inc_excludes_dot> (C<-Ddefault_inc_excludes_dot> being the +default now). + +If you'd like to add C<.> back to C<@INC> at runtime set +C<PERL_USE_UNSAFE_INC=1> in the environment before starting +perl. Setting it to 1 restores C<.> in the C<@INC> when perl otherwise +lacks it. + +Various toolchain modules will set C<PERL_USE_UNSAFE_INC=1> +themselves. E.g. L<Test::Harness> sets it since loading modules from a +relative path is a common idiom in test code. If you find that you +have C<.> in C<@INC> on a perl built with default settings it's likely +that your code is being invoked by a toolchain module of some sort. =head2 @{^CAPTURE}, %{^CAPTURE}, and %{^CAPTURE_ALL} C<@{^CAPTURE}> exposes the capture buffers of the last match as an -array. So C<$1> is C<${^CAPTURE}[0]>. +array. So C<$1> is C<${^CAPTURE}[0]>. This is a more efficient equivalent +to code like C<substr($matched_string,$-[0],$+[0]-$-[0])>, and you don't +have to keep track of the C<$matched_string> either. This variable has no +single character equivalent. Note like the other regex magic variables +the contents of this variable is dynamic, if you wish to store it beyond +the lifetime of the match you must copy it to another array. -C<%{^CAPTURE}> is the equivalent to C<%+> (ie named captures) +C<%{^CAPTURE}> is the equivalent to C<%+> (ie named captures). Other than +being more self documenting there is no difference between the two forms. C<%{^CAPTURE_ALL}> is the equivalent to C<%-> (ie all named captures). +Other than being more self documenting there is no difference between the +two forms. =head2 Unicode 9.0 is now supported @@ -117,7 +129,7 @@ It is intended mainly for use in assignments to references. For example: use experimental 'refaliasing', 'declared_refs'; my \$a = \$b; -See L<perlref/Assigning to References> for slightly more detail. +See L<perlref/Assigning to References> for more details. =head2 Perl can now do default collation in UTF-8 locales on platforms that support it @@ -139,7 +151,7 @@ L<perllocale/Collation of strings containing embedded C<NUL> characters>. =head2 Lexical subroutines are no longer experimental -Using the C<lexical_subs> feature no longer emits a warning. Existing +Using the C<lexical_subs> feature introduced in v5.18 no longer emits a warning. Existing code that disables the C<experimental::lexical_subs> warning category that the feature previously used will continue to work. The C<lexical_subs> feature has no effect; all Perl code can use lexical @@ -190,12 +202,18 @@ source code. The name of a character may no longer contain non-breaking spaces. It has been deprecated to do so since Perl v5.22. +=head2 create a safer utf8_hop() called utf8_hop_safe() + +Unlike utf8_hop(), utf8_hop_safe() won't navigate before the beginning or after +the end of the supplied buffer. + =head1 Security =head2 Remove current dir (C<.>) from C<@INC> For security reasons, C<@INC> no longer contains the default directory -(C<.>). +(C<.>). See L<the Core Enhancements section/"'.' and @INC"> for +details. =head2 "Escaped" colons and relative paths in PATH @@ -327,7 +345,22 @@ Enhancements in Regex concat COW implementation. =item * -Speed up C<AV> and C<HV> clearing/undeffing. +Clearing hashes and arrays has been made slightly faster. Now code +like this is around 5% faster: + + my @a; + for my $i (1..3_000_000) { + @a = (1,2,3); + @a = (); + } + +and this code around 3% faster: + + my %h; + for my $i (1..3_000_000) { + %h = qw(a 1 b 2); + %h = (); + } =item * @@ -1634,7 +1667,7 @@ tests for perlbug. [perl #128020] =item * -C<DEFAULT_INC_EXCLUDES_DOT> has been turned on as default. +C<-Ddefault_inc_excludes_dot> has been turned on as default. =item * diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 2f776489be..0bd747184f 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -925,8 +925,8 @@ Mnemonic: like \digits. =item @{^CAPTURE} X<@{^CAPTURE}> X<@^CAPTURE> -An array which contains the capture buffers, if any, of the last -successful pattern match, not counting patterns matched +An array which exposes the contents of the capture buffers, if any, of +the last successful pattern match, not counting patterns matched in nested blocks that have been exited already. Note that the 0 index of @{^CAPTURE} is equivalent to $1, the 1 index @@ -940,6 +940,9 @@ should output "f-o-a-l". See also L</$I<digits>>, L</%{^CAPTURE}> and L</%{^CAPTURE_ALL}>. +Note that unlike most other regex magic variables there is no single +letter equivalent to C<@{^CAPTURE}>. + This variable was added in 5.25.7 =item $MATCH -- Perl5 Master Repository
