summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2016-12-30 14:51:30 +0000
committerSteve Hay <steve.m.hay@googlemail.com>2016-12-30 14:51:30 +0000
commita6beb839fe457ff8ed93b362217ef22dc08743f5 (patch)
tree64de7b2fe20a7f638ca6938e1b8b9c85e342f0ce
parent4e0180d0aee62e4f727d557f1190810bc1126190 (diff)
downloadperl-a6beb839fe457ff8ed93b362217ef22dc08743f5.tar.gz
Revert "[perl #128769] Improve base.pm @INC '.' handling"
This reverts commit 37e3ca14ffd858d3892118cd76f2e1e80c767d64.
-rw-r--r--MANIFEST1
-rw-r--r--dist/base/lib/base.pm14
-rw-r--r--dist/base/t/incdot.t19
3 files changed, 3 insertions, 31 deletions
diff --git a/MANIFEST b/MANIFEST
index 48b739424e..a8d68546f8 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2892,7 +2892,6 @@ dist/base/t/fields-5_6_0.t See if fields work
dist/base/t/fields-5_8_0.t See if fields work
dist/base/t/fields-base.t See if fields work
dist/base/t/fields.t See if fields work
-dist/base/t/incdoc.t Test how base.pm handles '.' in @INC
dist/base/t/isa.t See if base's behaviour doesn't change
dist/base/t/lib/Broken.pm Test module for base.pm
dist/base/t/lib/Dummy.pm Test module for base.pm
diff --git a/dist/base/lib/base.pm b/dist/base/lib/base.pm
index 8dc62bbd1c..ff1a16c1f7 100644
--- a/dist/base/lib/base.pm
+++ b/dist/base/lib/base.pm
@@ -96,9 +96,9 @@ sub import {
{
local $SIG{__DIE__};
my $fn = _module_to_filename($base);
- my $localinc = $INC[-1] eq '.';
- local @INC = @INC[0..$#INC-1] if $localinc;
eval {
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
require $fn
};
# Only ignore "Can't locate" errors from our eval require.
@@ -114,19 +114,11 @@ sub import {
unless (%{"$base\::"}) {
require Carp;
local $" = " ";
- my $e = <<ERROR;
+ Carp::croak(<<ERROR);
Base class package "$base" is empty.
(Perhaps you need to 'use' the module which defines that package first,
or make that module available in \@INC (\@INC contains: @INC).
ERROR
- if ($localinc && -e $fn) {
- $e .= <<ERROS;
- If you mean to load $fn from the current directory, you may
- want to try "use lib '.'".
-ERROS
- }
- $e =~ s/\n\z/)\n/;
- Carp::croak($e);
}
$sigdie = $SIG{__DIE__} || undef;
}
diff --git a/dist/base/t/incdot.t b/dist/base/t/incdot.t
deleted file mode 100644
index fadebc4a45..0000000000
--- a/dist/base/t/incdot.t
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-use base ();
-
-use Test::More tests => 2;
-
-if ($INC[-1] ne '.') { push @INC, '.' }
-
-my $inc = quotemeta "@INC[0..$#INC-1]";
-
-eval { 'base'->import("foo") };
-like $@, qr/\@INC contains: $inc\).\)/,
- 'Error does not list final dot in @INC (or mention use lib)';
-eval { 'base'->import('t::lib::Dummy') };
-like $@, qr<\@INC contains: $inc\).\n(?x:
- ) If you mean to load t/lib/Dummy\.pm from the current >,
- 'special cur dir message for existing files in . that are ignored';