From a67324b5622088422b0b0c1a403c594312452d16 Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sun, 4 Jun 2017 07:35:25 +1200 Subject: [PATCH 1/3] t/001_require.t: Force a relative path load for require test require_ok("Foo") is implemented in terms of require "Foo" This means: require "Foo.pm" Only loads "Foo.pm" from "." if: - '.' is in @INC ( Not true by default in Perl >5.25.11 ) - Foo.pm is not installed in Perl5lib ( dangerous assumption ) This forces require to side-step @INC traversal by using an explicit prefix of "./", which is special-cased in require. This fixes RT#120674 Bug: https://rt.cpan.org/Ticket/Display.html?id=120674 --- t/001_require.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/001_require.t b/t/001_require.t index fe0d205..d70b2d2 100755 --- a/t/001_require.t +++ b/t/001_require.t @@ -24,7 +24,7 @@ use File::Spec; use Test::More qw(no_plan); # Set up @INC at runtime with an absolute path. -my $lib_path = File::Spec->catdir(dirname($0), "..", "lib"); +my $lib_path = File::Spec->rel2abs(File::Spec->catdir(dirname($0), "..", "lib")); push(@INC, $lib_path); require_ok 'Google::Ads::AdWords::Client'; @@ -38,6 +38,6 @@ sub test_require { local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /redefine/; }; - require_ok($file_name); + require_ok("./$file_name"); } } -- 2.12.2 From 76f5a421585b8c85b7e39b91adb0b257d1d83665 Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sun, 4 Jun 2017 07:40:01 +1200 Subject: [PATCH 2/3] t/020_GenerateOfflineCredentials.t: Force relative path for script require "some/path.pl" previously fell into worknig due to '.' being in @INC, as this still invokes @INC traversal This change simply forces a "./" so that Perl uses direct access via a special-cased path instead of relying on @INC traversal, which becomes unsafe to depend on since Perl 5.25.11 --- t/020_GenerateOfflineCredentials.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/020_GenerateOfflineCredentials.t b/t/020_GenerateOfflineCredentials.t index 0dcde9d..dfa8b50 100755 --- a/t/020_GenerateOfflineCredentials.t +++ b/t/020_GenerateOfflineCredentials.t @@ -51,7 +51,7 @@ my $stdout; open(STDOUT, ">", \$stdout); # Calling the offline credentials code -require qw(examples/oauth/generate_offline_credentials.pl); +require qw(./examples/oauth/generate_offline_credentials.pl); ok(generate_offline_credentials($client)); # Checking the auth mock was correctly called -- 2.12.2