diff options
author | David Mitchell <davem@iabyn.com> | 2017-03-24 08:10:12 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-03-24 08:34:06 +0000 |
commit | 6ee05a9b9195a324347204414de1405b2b0771e3 (patch) | |
tree | 44d5710d9f7c68abd4a71f8c4cad4034b01e91f4 | |
parent | 772973e0724bdb6a9124827cd75fc2db56e5a443 (diff) | |
download | perl-6ee05a9b9195a324347204414de1405b2b0771e3.tar.gz |
Revert base.pm's dot-in-INC changes.
This reverts:
458470f62360040dcd4b5a55c8ba07503e1af5fc
362f3f748cb84934a072fadbfb8b51090e2f9afe
bca552795994a553e07b38a6f82a233533919926
and the base.pm part of
8901ddee94b1bc3764b4278d1cb26bed30bc2605
This commit removes all the recent stuff that made base.pm localise
@INC and remove a trailing '.'.
This is because perl 5.26.0 will be released with '.' in @INC disabled by
default.
See RT #128769.
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | dist/base/lib/base.pm | 21 | ||||
-rw-r--r-- | dist/base/t/incdot.t | 19 |
3 files changed, 2 insertions, 39 deletions
@@ -3234,7 +3234,6 @@ dist/base/t/fields.t See if fields work 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/incdot.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 38c91c731c..f7a2480381 100644 --- a/dist/base/lib/base.pm +++ b/dist/base/lib/base.pm @@ -97,11 +97,7 @@ sub import { { local $SIG{__DIE__}; my $fn = _module_to_filename($base); - local @INC = @INC; - pop @INC if my $dotty = $INC[-1] eq '.'; - eval { - require $fn - }; + eval { require $fn }; # Only ignore "Can't locate" errors from our eval require. # Other fatal errors (syntax etc) must be reported. # @@ -115,24 +111,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 ($dotty && -e $fn) { - $e .= <<ERROS; - The file $fn does exist in the current directory. But note - that base.pm, when loading a module, now ignores the current working - directory if it is the last entry in \@INC. If your software worked on - previous versions of Perl, the best solution is to use FindBin to - detect the path properly and to add that path to \@INC. As a last - resort, you can re-enable looking in the current working directory by - adding "use lib '.'" to your code. -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 1619492250..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: - ) The file t/lib/Dummy\.pm does exist in the current direct>, - 'special cur dir message for existing files in . that are ignored'; |