Subject: | Module::Build ignores changes to @INC when writing Build from new_from_context |
Looks like when Build.PL is called, which writes the Build script, some local changes to @INC are lost. The below script demonstrates this:
[kane@myriad /tmp/Devel-Caller-Perl-1.4]$ ls
./ INSTALL Makefile.PL t/
../ MANIFEST README x.pl
Build.PL META.yml lib/
[kane@myriad /tmp/Devel-Caller-Perl-1.4]$ cat x.pl
eval { require Module::Build; 1 };
warn "[ONE] Failed to load M::B $@" if $@;
### add a path to M::B to @INC
unshift @INC, @ARGV;
eval { require Module::Build; 1 };
warn "[TWO] Failed to load M::B $@" if $@;
eval { Module::Build->new_from_context };
warn "[THREE] Failed to load M::B $@" if $@;
[kane@myriad /tmp/Devel-Caller-Perl-1.4]$ perlc x.pl /Users/kane/sources/p4/cpanplus/devel/lib/CPANPLUS/inc/installers
[ONE] Failed to load M::B Can't locate Module/Build.pm in @INC (@INC contains: /sw/lib/perl5 /sw/lib/perl5/darwin /Users/kane/sources/p4/other/archive-extract/lib /Users/kane/sources/p4/other/file-fetch/lib /Users/kane/sources/p4/other/archive-tar-new/lib /Users/kane/sources/p4/other/carp-trace/lib /Users/kane/sources/p4/other/log-message/lib /Users/kane/sources/p4/other/module-load/lib /Users/kane/sources/p4/other/params-check/lib /Users/kane/sources/p4/other/qmail-checkpassword/lib /Users/kane/sources/p4/other/module-load-conditional/lib /Users/kane/sources/p4/other/term-ui/lib /Users/kane/sources/p4/other/ipc-cmd/lib /Users/kane/sources/p4/other/config-auto/lib /Users/kane/sources/NSA /Users/kane/sources/NSA/misc /Users/kane/sources/NSA/test /Users/kane/sources/beheer/perl /opt/lib/perl5/5.8.3/darwin-2level /opt/lib/perl5/5.8.3 /opt/lib/perl5/site_perl/5.8.3/darwin-2level /opt/lib/perl5/site_perl/5.8.3 /opt/lib/perl5/site_perl .) at x.pl line 1.
/opt/bin/perl Build.PL
Can't locate Module/Build.pm in @INC (@INC contains: /sw/lib/perl5 /sw/lib/perl5/darwin /Users/kane/sources/p4/other/archive-extract/lib /Users/kane/sources/p4/other/file-fetch/lib /Users/kane/sources/p4/other/archive-tar-new/lib /Users/kane/sources/p4/other/carp-trace/lib /Users/kane/sources/p4/other/log-message/lib /Users/kane/sources/p4/other/module-load/lib /Users/kane/sources/p4/other/params-check/lib /Users/kane/sources/p4/other/qmail-checkpassword/lib /Users/kane/sources/p4/other/module-load-conditional/lib /Users/kane/sources/p4/other/term-ui/lib /Users/kane/sources/p4/other/ipc-cmd/lib /Users/kane/sources/p4/other/config-auto/lib /Users/kane/sources/NSA /Users/kane/sources/NSA/misc /Users/kane/sources/NSA/test /Users/kane/sources/beheer/perl /opt/lib/perl5/5.8.3/darwin-2level /opt/lib/perl5/5.8.3 /opt/lib/perl5/site_perl/5.8.3/darwin-2level /opt/lib/perl5/site_perl/5.8.3 /opt/lib/perl5/site_perl .) at Build.PL line 4.
BEGIN failed--compilation aborted at Build.PL line 4.
[THREE] Failed to load M::B Can't read '': No such file or directory at /Users/kane/sources/p4/cpanplus/devel/lib/CPANPLUS/inc/installers/Module/Build/Base.pm line 710.
[kane@myriad /tmp/Devel-Caller-Perl-1.4]$