diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2016-12-30 14:51:15 +0000 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2016-12-30 14:51:15 +0000 |
commit | e28961db8c9539b25a01ac91a2255ca7da9f7abf (patch) | |
tree | 28af4171066fb572b2d69b68ab55f63c4bc2640e | |
parent | 9ecc5e9b1832c6fa319505037cc313232ebead35 (diff) | |
download | perl-e28961db8c9539b25a01ac91a2255ca7da9f7abf.tar.gz |
Revert "try to minimise fallout of base @INC fiddling"
This reverts commit 5d8239256e461c077b28d825d18f71242fe53d44.
-rw-r--r-- | dist/base/lib/base.pm | 12 | ||||
-rw-r--r-- | dist/base/t/incdot.t | 2 | ||||
-rw-r--r-- | dist/base/t/incmodified-vs-incdot.t | 27 | ||||
-rw-r--r-- | dist/base/t/lib/BaseIncDoubleExtender.pm | 9 | ||||
-rw-r--r-- | dist/base/t/lib/BaseIncExtender.pm | 7 |
5 files changed, 4 insertions, 53 deletions
diff --git a/dist/base/lib/base.pm b/dist/base/lib/base.pm index c919ac1c73..1aa814bff9 100644 --- a/dist/base/lib/base.pm +++ b/dist/base/lib/base.pm @@ -5,12 +5,6 @@ use vars qw($VERSION); $VERSION = '2.22_01'; $VERSION = eval $VERSION; -# simplest way to avoid indexing of the package: no package statement -sub base::__inc_scope_guard::DESTROY { - my $noop = $_[0][0]; - ref $_ and $_ == $noop and $_ = '.' for @INC; -} - # constant.pm is slow sub SUCCESS () { 1 } @@ -96,15 +90,15 @@ sub import { next if grep $_->isa($base), ($inheritor, @bases); - # Following blocks help isolate $SIG{__DIE__} and @INC changes + # Following blocks help isolate $SIG{__DIE__} changes { my $sigdie; { local $SIG{__DIE__}; my $fn = _module_to_filename($base); - my $dotty = $INC[-1] eq '.' && ( $INC[-1] = sub {()} ); + local @INC = @INC; + pop @INC if my $dotty = $INC[-1] eq '.'; eval { - my $redotty = $dotty && bless [ $dotty ], 'base::__inc_scope_guard'; require $fn }; # Only ignore "Can't locate" errors from our eval require. diff --git a/dist/base/t/incdot.t b/dist/base/t/incdot.t index e0619a6d4c..1619492250 100644 --- a/dist/base/t/incdot.t +++ b/dist/base/t/incdot.t @@ -8,7 +8,7 @@ use Test::More tests => 2; if ($INC[-1] ne '.') { push @INC, '.' } -my $inc = quotemeta "@INC"; +my $inc = quotemeta "@INC[0..$#INC-1]"; eval { 'base'->import("foo") }; like $@, qr/\@INC contains: $inc\).\)/, diff --git a/dist/base/t/incmodified-vs-incdot.t b/dist/base/t/incmodified-vs-incdot.t deleted file mode 100644 index a5288e861f..0000000000 --- a/dist/base/t/incmodified-vs-incdot.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use Test::More tests => 10; # one test is in each BaseInc* itself - -use lib 't/lib'; - -# make it look like an older perl -BEGIN { push @INC, '.' if $INC[-1] ne '.' } - -use base 'BaseIncExtender'; - -BEGIN { - is $INC[0], 't/lib/blahblah', 'modules loaded by base can prepend entries to @INC'; - is $INC[1], 't/lib', 'previously prepended additional @INC entry remains'; - is $INC[-1], '.', 'dot still at end @INC after using base'; -} - -use base 'BaseIncDoubleExtender'; - -BEGIN { - is $INC[0], 't/lib/blahdeblah', 'modules loaded by base can prepend entries to @INC'; - is $INC[1], 't/lib/blahblah', 'previously prepended additional @INC entry remains'; - is $INC[2], 't/lib', 'previously prepended additional @INC entry remains'; - is $INC[-2], '.', 'dot still at previous end of @INC after using base'; - is $INC[-1], 't/lib/on-end', 'modules loaded by base can append entries to @INC'; -} diff --git a/dist/base/t/lib/BaseIncDoubleExtender.pm b/dist/base/t/lib/BaseIncDoubleExtender.pm deleted file mode 100644 index 455c5de513..0000000000 --- a/dist/base/t/lib/BaseIncDoubleExtender.pm +++ /dev/null @@ -1,9 +0,0 @@ -package BaseIncDoubleExtender; - -BEGIN { ::ok( $INC[-1] ne '.', 'no trailing dot in @INC during module load from base' ) } - -use lib 't/lib/blahdeblah'; - -push @INC, 't/lib/on-end'; - -1; diff --git a/dist/base/t/lib/BaseIncExtender.pm b/dist/base/t/lib/BaseIncExtender.pm deleted file mode 100644 index 3b693adc06..0000000000 --- a/dist/base/t/lib/BaseIncExtender.pm +++ /dev/null @@ -1,7 +0,0 @@ -package BaseIncExtender; - -BEGIN { ::ok( $INC[-1] ne '.', 'no trailing dot in @INC during module load from base' ) } - -use lib 't/lib/blahblah'; - -1; |