Subject: | [PATCH] Avoid -I when calling subprocess |
When testing large numbers of modules via the CPAN shell, it is very easy to exhaust the maximum length for @ARGV. The attached patch uses the environment instead. It’s true that the environment has limits, too, but they are generally larger that argument list limits. I hope you will consider applying this patch, which solved the problem for me.
Subject: | open_gYWyjvsR.txt |
diff -rup B-Debug-1.25-1/t/debug.t B-Debug-1.25-0/t/debug.t
--- B-Debug-1.25-1/t/debug.t 2016-12-11 09:04:09.000000000 -0800
+++ B-Debug-1.25-0/t/debug.t 2017-12-03 12:20:40.000000000 -0800
@@ -32,17 +32,18 @@ use File::Spec;
my $a;
my $X = $^X =~ m/\s/ ? qq{"$^X"} : $^X;
-my $path = join " ", map { qq["-I$_"] } (File::Spec->catfile("blib","lib"), @INC);
+local $ENV{PERL5LIB} =
+ join $Config{path_sep}, File::Spec->catfile("blib","lib"), @INC;
my $redir = $^O =~ /VMS|MSWin32|MacOS/ ? "" : "2>&1";
-$a = `$X $path "-MO=Debug" -e 1 $redir`;
+$a = `$X "-MO=Debug" -e 1 $redir`;
like($a, qr/\bLISTOP\b.*\bOP\b.*\bCOP\b.*\bOP\b/s);
-$a = `$X $path "-MO=Terse" -e 1 $redir`;
+$a = `$X "-MO=Terse" -e 1 $redir`;
like($a, qr/\bLISTOP\b.*leave.*\n OP\b.*enter.*\n COP\b.*nextstate.*\n OP\b.*null/s);
-$a = `$X $path "-MO=Terse" -ane "s/foo/bar/" $redir`;
+$a = `$X "-MO=Terse" -ane "s/foo/bar/" $redir`;
$a =~ s/\(0x[^)]+\)//g;
$a =~ s/\[[^\]]+\]//g;
$a =~ s/-e syntax OK//;
@@ -81,14 +82,14 @@ is($a, $b);
like(B::Debug::_printop(B::main_root), qr/LISTOP\s+\[OP_LEAVE\]/);
like(B::Debug::_printop(B::main_start), qr/OP\s+\[OP_ENTER\]/);
-$a = `$X $path "-MO=Debug" -e "B::main_root->debug" $redir`;
+$a = `$X "-MO=Debug" -e "B::main_root->debug" $redir`;
like($a, qr/op_next\s+0x0/m);
-$a = `$X $path "-MO=Debug" -e "B::main_start->debug" $redir`;
+$a = `$X "-MO=Debug" -e "B::main_start->debug" $redir`;
like($a, qr/\[OP_ENTER\]/m);
# pass missing FETCHSIZE, fixed with 1.06
my $e = q(BEGIN{tie @a, __PACKAGE__;sub TIEARRAY {bless{}} sub FETCH{1}};print $a[1]);
-$a = `$X $path "-MO=Debug" -e"$e" $redir`;
+$a = `$X "-MO=Debug" -e"$e" $redir`;
unlike($a, qr/locate object method "FETCHSIZE"/m);
# NV assertion with CV, fixed with 1.13
@@ -96,7 +97,7 @@ my $tmp = "tmp.pl";
open TMP, ">", $tmp;
print TMP 'my $p=1;$g=2;sub p($){my $i=1;$i+1};print p(0)+$g;';
close TMP;
-$a = `$X $path "-MO=Debug" $tmp $redir`;
+$a = `$X "-MO=Debug" $tmp $redir`;
ok(! $?);
unlike($a, qr/assertion "SvTYPE(sv) != SVt_PVCV" failed.*function: S_sv_2iuv_common/m);
unlike($a, qr/Use of uninitialized value in print/m);