5

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.

Community
  • 1
  • 1
mrk
  • 51
  • 4
  • 2
    Did you install `cpanm` with `perlbrew install-cpanm`? What does `which cpanm` show? – ThisSuitIsBlackNot Apr 03 '15 at 17:30
  • 1
    @ThisSuitIsBlackNot thanks for the quick response. Doing `perlbrew install-cpanm` returns `cpanm is installed to /home/qwerty/perl5/perlbrewbin/cpanm`. When I do `which cpanm` I get `/home/qwerty/perl5/perlbrew/bin/cpanm` – mrk Apr 03 '15 at 17:44

2 Answers2

0

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?

Jjj
  • 11
  • 4
0

Ancient question, but still relevant! (this bit me in 2023).

Answer: Be sure PERL5LIB is not set.

In my case, I previously (before installing perlbrew) had the usual CPAN local::lib setup and set PERL5LIB=$HOME/lib/perl5/lib/perl5 in my .profile which made perl look there before it's "system" locations (perlbrew compiles Perl with a special Config which replaces /usr/local with a version-specific subdir, and that's where perlbrew's cpanm installs stuff).

jimav
  • 671
  • 6
  • 16