summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2016-06-23 14:06:40 +1000
committerSteve Hay <steve.m.hay@googlemail.com>2016-07-24 18:18:11 +0100
commitac5b10a9c5ff29cb2fbb732524e471547414c5f8 (patch)
treefc9918a3f0f477de9050d94d1dfb0348e539c172
parent211eea87679bae9960e7e55689ab52dac83a80ee (diff)
downloadperl-ac5b10a9c5ff29cb2fbb732524e471547414c5f8.tar.gz
dist/: remove . from @INC when loading optional modules
-rw-r--r--cpan/Test/lib/Test.pm7
-rw-r--r--dist/I18N-LangTags/lib/I18N/LangTags/Detect.pm2
-rw-r--r--dist/IO/IO.pm2
-rw-r--r--dist/Locale-Maketext/lib/Locale/Maketext.pm2
-rw-r--r--dist/Net-Ping/lib/Net/Ping.pm6
-rw-r--r--dist/PathTools/Cwd.pm5
-rw-r--r--dist/PathTools/lib/File/Spec/Cygwin.pm6
-rw-r--r--dist/PathTools/lib/File/Spec/VMS.pm5
-rw-r--r--dist/PathTools/lib/File/Spec/Win32.pm6
-rw-r--r--dist/Storable/Storable.pm8
-rw-r--r--dist/base/lib/base.pm6
11 files changed, 47 insertions, 8 deletions
diff --git a/cpan/Test/lib/Test.pm b/cpan/Test/lib/Test.pm
index 108bc10a16..7c2c9d3a5f 100644
--- a/cpan/Test/lib/Test.pm
+++ b/cpan/Test/lib/Test.pm
@@ -480,7 +480,12 @@ sub _diff_complain {
my($result, $expected, $detail, $prefix) = @_;
return _diff_complain_external(@_) if $ENV{PERL_TEST_DIFF};
return _diff_complain_algdiff(@_)
- if eval { require Algorithm::Diff; Algorithm::Diff->VERSION(1.15); 1; };
+ if eval {
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ require Algorithm::Diff; Algorithm::Diff->VERSION(1.15);
+ 1;
+ };
$told_about_diff++ or print $TESTERR <<"EOT";
# $prefix (Install the Algorithm::Diff module to have differences in multiline
diff --git a/dist/I18N-LangTags/lib/I18N/LangTags/Detect.pm b/dist/I18N-LangTags/lib/I18N/LangTags/Detect.pm
index f13d5460b3..e9c3aaab58 100644
--- a/dist/I18N-LangTags/lib/I18N/LangTags/Detect.pm
+++ b/dist/I18N-LangTags/lib/I18N/LangTags/Detect.pm
@@ -145,6 +145,8 @@ sub _try_use { # Basically a wrapper around "require Modulename"
print " About to use $module ...\n" if DEBUG;
{
local $SIG{'__DIE__'};
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
eval "require $module"; # used to be "use $module", but no point in that.
}
if($@) {
diff --git a/dist/IO/IO.pm b/dist/IO/IO.pm
index 2762958210..982871d93d 100644
--- a/dist/IO/IO.pm
+++ b/dist/IO/IO.pm
@@ -18,6 +18,8 @@ sub import {
my @l = @_ ? @_ : qw(Handle Seekable File Pipe Socket Dir);
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
eval join("", map { "require IO::" . (/(\w+)/)[0] . ";\n" } @l)
or croak $@;
}
diff --git a/dist/Locale-Maketext/lib/Locale/Maketext.pm b/dist/Locale-Maketext/lib/Locale/Maketext.pm
index 24c31ea9d6..facc32ae43 100644
--- a/dist/Locale-Maketext/lib/Locale/Maketext.pm
+++ b/dist/Locale-Maketext/lib/Locale/Maketext.pm
@@ -449,6 +449,8 @@ sub _try_use { # Basically a wrapper around "require Modulename"
local $SIG{'__DIE__'};
local $@;
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
eval "require $module"; # used to be "use $module", but no point in that.
if($@) {
diff --git a/dist/Net-Ping/lib/Net/Ping.pm b/dist/Net-Ping/lib/Net/Ping.pm
index 2766c9edbb..c9cbd27356 100644
--- a/dist/Net-Ping/lib/Net/Ping.pm
+++ b/dist/Net-Ping/lib/Net/Ping.pm
@@ -410,7 +410,11 @@ sub ping_external {
$timeout # Seconds after which ping times out
) = @_;
- eval { require Net::Ping::External; }
+ eval {
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ require Net::Ping::External;
+ }
or croak('Protocol "external" not supported on your system: Net::Ping::External not found');
return Net::Ping::External::ping(ip => $ip, timeout => $timeout);
}
diff --git a/dist/PathTools/Cwd.pm b/dist/PathTools/Cwd.pm
index b4e80c63a1..1a58a46ac7 100644
--- a/dist/PathTools/Cwd.pm
+++ b/dist/PathTools/Cwd.pm
@@ -40,7 +40,10 @@ if ($^O eq 'os2') {
my $use_vms_feature;
BEGIN {
if ($^O eq 'VMS') {
- if (eval { local $SIG{__DIE__}; require VMS::Feature; }) {
+ if (eval { local $SIG{__DIE__};
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ require VMS::Feature; }) {
$use_vms_feature = 1;
}
}
diff --git a/dist/PathTools/lib/File/Spec/Cygwin.pm b/dist/PathTools/lib/File/Spec/Cygwin.pm
index e4d55e1ab4..3ae0e99565 100644
--- a/dist/PathTools/lib/File/Spec/Cygwin.pm
+++ b/dist/PathTools/lib/File/Spec/Cygwin.pm
@@ -137,7 +137,11 @@ sub case_tolerant {
if ($mntopts and ($mntopts =~ /,managed/)) {
return 0;
}
- eval { require Win32API::File; } or return 1;
+ eval {
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ require Win32API::File;
+ } or return 1;
my $osFsType = "\0"x256;
my $osVolName = "\0"x256;
my $ouFsFlags = 0;
diff --git a/dist/PathTools/lib/File/Spec/VMS.pm b/dist/PathTools/lib/File/Spec/VMS.pm
index 964b26c439..0b2ba1f1fd 100644
--- a/dist/PathTools/lib/File/Spec/VMS.pm
+++ b/dist/PathTools/lib/File/Spec/VMS.pm
@@ -39,7 +39,10 @@ via the C<DECC$FILENAME_UNIX_REPORT> CRTL feature.
my $use_feature;
BEGIN {
- if (eval { local $SIG{__DIE__}; require VMS::Feature; }) {
+ if (eval { local $SIG{__DIE__};
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ require VMS::Feature; }) {
$use_feature = 1;
}
}
diff --git a/dist/PathTools/lib/File/Spec/Win32.pm b/dist/PathTools/lib/File/Spec/Win32.pm
index 9a368474b1..5435138d67 100644
--- a/dist/PathTools/lib/File/Spec/Win32.pm
+++ b/dist/PathTools/lib/File/Spec/Win32.pm
@@ -90,7 +90,11 @@ Default: 1
=cut
sub case_tolerant {
- eval { require Win32API::File; } or return 1;
+ eval {
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ require Win32API::File;
+ } or return 1;
my $drive = shift || "C:";
my $osFsType = "\0"x256;
my $osVolName = "\0"x256;
diff --git a/dist/Storable/Storable.pm b/dist/Storable/Storable.pm
index bd0632f832..7b6e1a0a1d 100644
--- a/dist/Storable/Storable.pm
+++ b/dist/Storable/Storable.pm
@@ -25,7 +25,13 @@ use vars qw($canonical $forgive_me $VERSION);
$VERSION = '2.53_01';
BEGIN {
- if (eval { local $SIG{__DIE__}; require Log::Agent; 1 }) {
+ if (eval {
+ local $SIG{__DIE__};
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ require Log::Agent;
+ 1;
+ }) {
Log::Agent->import;
}
#
diff --git a/dist/base/lib/base.pm b/dist/base/lib/base.pm
index 5d1378786d..2b1509620d 100644
--- a/dist/base/lib/base.pm
+++ b/dist/base/lib/base.pm
@@ -96,7 +96,11 @@ sub import {
{
local $SIG{__DIE__};
my $fn = _module_to_filename($base);
- eval { require $fn };
+ eval {
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ require $fn
+ };
# Only ignore "Can't locate" errors from our eval require.
# Other fatal errors (syntax etc) must be reported.
#