Skip to content

Commit 362f3f7

Browse files
author
Father Chrysostomos
committed
[perl #128769] base.pm: Localize @inc unconditionally
As Zefram pointed out in <https://rt.perl.org/Ticket/Display.html?id=128769#txn-1414015>, having inconsistent behaviour is going to cause more problems than solves.
1 parent 8eb6215 commit 362f3f7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dist/base/lib/base.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ sub import {
9797
{
9898
local $SIG{__DIE__};
9999
my $fn = _module_to_filename($base);
100-
my $localinc = $INC[-1] eq '.';
101-
local @INC = @INC[0..$#INC-1] if $localinc;
100+
local @INC = @INC;
101+
pop @INC if my $dotty = $INC[-1] eq '.';
102102
eval {
103103
require $fn
104104
};
@@ -120,7 +120,7 @@ Base class package "$base" is empty.
120120
(Perhaps you need to 'use' the module which defines that package first,
121121
or make that module available in \@INC (\@INC contains: @INC).
122122
ERROR
123-
if ($localinc && -e $fn) {
123+
if ($dotty && -e $fn) {
124124
$e .= <<ERROS;
125125
If you mean to load $fn from the current directory, you may
126126
want to try "use lib '.'".

0 commit comments

Comments
 (0)