PCaetano
PCaetano

Reputation: 601

Perl - Path specified with -I doesn't show up on @INC

I'm setting up a local perl installation on a machine with no internet connection (for now, I'm just doing a PoC on a VM). I've installed my local perl, CPAN, and MakeMaker from the RPM repo, and now I'm trying to build local::lib, using this command:

perl -I /home/serveradmin/local/usr/share/perl5 Makefile.PL --bootstrap=~/local/usr --no-manpages

The -I path is the location of CPAN and MakeMaker.

> find /home/serveradmin/local -name CPAN.pm
/home/serveradmin/local/usr/share/perl5/CPAN.pm

> find /home/serveradmin/local -name MakeMaker.pm
/home/serveradmin/local/usr/share/perl5/ExtUtils/MakeMaker.pm

However, it's failing with the following errors:

Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains:
/home/serveradmin/local/usr/lib/perl5/5.10.0 /home/serveradmin/local/usr/lib/perl5 
/usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl 
/usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at inc/ConfigCPAN.pm line 15.

Can't locate CPAN.pm in @INC (@INC contains: 
/home/serveradmin/local/usr/lib/perl5/5.10.0 /home/serveradmin/local/usr/lib/perl5 
/usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl 
/usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .).

perl -V and env -i perl -V both produce the same @INC (neither PERLLIB nor PERL5LIB are set; actually, env | grep -i perl shows no result):

/usr/local/lib/perl5
/usr/local/share/perl5
/usr/lib/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib/perl5
/usr/share/perl5
.

The path I specified on -I doesn't show up on the @INC shown on the errors, which makes it seem like -I is not working. But if I run

perl -I /home/serveradmin/local/usr/share/perl5 -V

this correctly prepends the path to @INC.

My google-fu shed no light on this, so any help/pointer is appreciated.

Thanks for your time.

Upvotes: 3

Views: 926

Answers (1)

ikegami
ikegami

Reputation: 385496

Makefile.PL is probably launching another instance of perl, but without respecifying the -I option (since it has no idea it needs to). Using env var PERL5LIB should get you around that problem since it gets passed from parent process to child process.

That said, I suggest you fix your broken Perl installation instead. perlbrew makes it easy to install Perl, but it's quite simple to do it without too. If you opt not to use perlbrew, read INSTALL for the commands you have to type in and to see how to specify where it should be installed to. Don't forget to pass -Dusethreads to Configure if you want thread support.

Upvotes: 1

Related Questions