问题
I am trying to use perlbrew to run a set of perl scripts. When I try installing dependencies for these perl scripts, they are installed into my system's perl version (5.18.X) and not the version I want to use (5.10.1). I have tried several suggestions from other threads on stackoverflow, but to no avail.
Here's an example of what happens. I'll do the following:
perlbrew use perl-5.10.1
perl -v (returns with perl-5.10.1)
cpanm Parallel::ForkManager (returns Paralell::ForkManager is installed)
When I run my script using under perlbrew I get the following:
perl PERLSCRIPT.pl
Can't locate Parallel/ForkManager.pm in @INC (@INC contains: /home/qwerty/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1/x86_64-linux-thread-multi /home/qwerty/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1 /home/qwerty/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux-thread-multi /home/qwerty/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1
Any help is appreciated. If any other information is needed, please let me know.
System OS: Ubuntu 64-bit run through VMware (host is Windows 8.1 pro);
Edit: It seems that doing perlbrew exec cpanm perl::module
works. However, If anyone has other suggestions, I'd be glad to hear them.
回答1:
Try using
perlbrew switch perl-5.10.1
instead of
perlbrew use perl-5.10.1
The "use" command only sets the perl for the current shell. Maybe you switched shells in between?
来源:https://stackoverflow.com/questions/29436961/installing-modules-when-using-perlbrew