CC: | andk [...] cpan.org |
Subject: | tests should localize PERL5OPT |
Tests will fail if user has set PERL5OPT to load any modules.
Localizing $ENV{PERL5OPT} in the spawn() function in your tests will
avoid these failures.
Patch file attached.
-- David
Subject: | protect-perl5opt.patch |
diff --git a/t/01-B-PerlReq.t b/t/01-B-PerlReq.t
index 3973cad..6c4be31 100644
--- a/t/01-B-PerlReq.t
+++ b/t/01-B-PerlReq.t
@@ -7,6 +7,7 @@ use Fcntl qw(F_SETFD);
sub spawn ($) {
my $code = shift;
+ local $ENV{PERL5OPT};
open my $pipe, "-|", $^X, qw(-Mblib -MO=PerlReq -e) => $code
or return (undef, undef);
my $output = join '' => <$pipe>;
diff --git a/t/02-perlreq.t b/t/02-perlreq.t
index 26c6aa0..412d416 100644
--- a/t/02-perlreq.t
+++ b/t/02-perlreq.t
@@ -6,6 +6,7 @@ use Fcntl qw(F_SETFD);
sub spawn ($) {
my $file = shift;
use 5.007_001; # the list form of open() for pipes
+ local $ENV{PERL5OPT};
open my $pipe, "-|", $^X, qw(-Mblib perl.req) => $file
or return (undef, undef);
my $output = join '' => <$pipe>;