Subject: | t/100-internal-verbose.t fails with strange PERL5LIB |
If PERL5LIB or @INC contains shell metacharacters like parentheses or a simple space, then the t/100-internal-verbose.t test fails. This can easily be reproduced by running
env PERL5LIB="/tmp/directory with spaces" perl -Mblib t/100-internal-verbose.t
Shell metacharacters in @INC may also happen as Module::Build seems to preserve the active lib search path in the generated Build. In one case I found the following contents in Test-Compile's Build:
unshift @INC,
(
'CODE(0x1eb09d8)',
'/home/eserte/.cpan/build/CPAN-Mini-Inject-0.33-0JcKJY/blib/arch',
'/home/eserte/.cpan/build/CPAN-Mini-Inject-0.33-0JcKJY/blib/lib',
'/home/eserte/.cpan/build/CPAN-Mini-1.111016-SKS9Qh/blib/arch',
'/home/eserte/.cpan/build/CPAN-Mini-1.111016-SKS9Qh/blib/lib',
'/home/eserte/.cpan/build/Dist-Metadata-0.926-cgTO_S/blib/arch',
'/home/eserte/.cpan/build/Dist-Metadata-0.926-cgTO_S/blib/lib',
'/home/eserte/.cpan/build/File-Spec-Native-1.003-p5o9Bf/blib/arch',
'/home/eserte/.cpan/build/File-Spec-Native-1.003-p5o9Bf/blib/lib',
'/home/eserte/.cpan/build/CPAN-Checksums-2.10-lECLGk/blib/arch',
'/home/eserte/.cpan/build/CPAN-Checksums-2.10-lECLGk/blib/lib'
);
Probably it's also a Module::Build bug to stringify code references here. Nevertheless the "(" in 'CODE(0x1eb09d8)' is special for the shell and is causing the failure.
Maybe it's better to set the env variable like this:
local $ENV{PERL5LIB} = $lib;
my $cmd = "$^X $0";