In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/7bb6e12450c58b7094ccdfa7025fa495d3996bcf?hp=b4dcd72d7c1fd970030db81f13b3824d51aeb9b6>

- Log -----------------------------------------------------------------
commit 7bb6e12450c58b7094ccdfa7025fa495d3996bcf
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Feb 23 19:32:51 2018 -0800

    Carp: Avoid string eval
    
    Carp’s particular use of string eval is unnecessary in this case, and
    slower than the alternative.  Carp’s reason for using string eval is
    to avoid the effect of bareword require vivifying a package.  But that
    only applies to bareword require, and not other forms of require:
    
    $ perl -le 'print $::{"overload::"}||"nothing"; require overload'
    *main::overload::
    $ perl -le 'print $::{"overload::"}||"nothing"; require "overload.pm"'
    nothing
    
    Since string eval has to set up a parser and a new scope, it is much
    slower that require, and quite unnecessary here.

-----------------------------------------------------------------------

Summary of changes:
 dist/Carp/lib/Carp.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm
index 610e07fe1a..3de78d9f6f 100644
--- a/dist/Carp/lib/Carp.pm
+++ b/dist/Carp/lib/Carp.pm
@@ -343,10 +343,10 @@ sub format_arg {
                # so we need to use overload::StrVal() below.  But it's
                # possible that the overload module hasn't been loaded:
                # overload methods can be installed without it.  So load
-               # the module here.  The eval layer here avoids the
-               # compile-time effect of require vivifying the target
-               # module's stash.
-                eval "require overload; 1"
+               # the module here.  The bareword form of require is here
+               # eschewed to avoid iths compile-time effect of vivifying
+               # vivifying the target module's stash.
+                require "overload.pm"
                     or return "use overload failed";
             }
             my $sub = _fetch_sub(overload => 'StrVal');

-- 
Perl5 Master Repository

Reply via email to