Can't locate in @INC during CPAN dependency install performed not as root
While trying to do:
perl -I'/v1/data/site_perl' -MCPAN -e 'install L开发者_高级运维og::Dispatch';
I continue to get "Can't locate Params/Validate.pm in @INC." When looking at the output, /v1/data/site_perl is NOT in the @INC displayed, even though I used -I.
I am not root so I have changed my CPAN config so that:
'makepl_arg' => q[LIB=/v1/data/site_perl INSTALLSITEMAN1DIR=/v1/data/site_perl/man/man1 INSTALLSITEMAN3DIR=/v1/data/site_perl/man/man3 INSTALLMAN1DIR=/v1/data/site_perl/man/man1 INSTALLMAN3DIR=/v1/data/site_perl/man/man3]
So even LIB is set.
In a basic script I have:
use lib '/v1/data/site_perl';
use Params::Validate;
With no problems.
How do I make the Log::Dispatch use lib /v1/data/site_perl without a force install? What am I missing?
I believe CPAN.pm likes to call a lot of sub-processes for various tasks, and these end up starting new perl
s, which will not inherit your -I
flag. Instead, try setting a PERL5LIB
environment variable, e.g.
PERL5LIB='/v1/data/site_perl' perl -MCPAN -e 'install Log::Dispatch'
Another strategy to consider is to simply build a complete Perl installation in your local directory -- then use that perl's CPAN utilities. They will already have all your own paths built-in. This is the way I tend to do it.
You cannot install into a different CPAN directory using a simple -I
flag. You can use the local::lib package to install a local set of libraries, or see this question and this question.
精彩评论