Question

I installed perl-5.12.2 using perlbrew:

perlbrew install perl-5.12.2 -D=usethreads -D=useithreads -D=uselargefiles -f

I then switched to this version and installed IPC::System::Simple using cpanm.

However, when I try to run my script I get:

Can't locate IPC/System/Simple.pm in @INC (@INC contains: /home/dave/workspace/proj1/scripts/bin/../lib /home/dave/src/bioperl-live /home/dave/perl5/perlbrew/perls/perl-5.12.2/lib/site_perl/5.12.2/x86_64-linux-thread-multi /home/dave/perl5/perlbrew/perls/perl-5.12.2/lib/site_perl/5.12.2 /home/dave/perl5/perlbrew/perls/perl-5.12.2/lib/5.12.2/x86_64-linux-thread-multi /home/dave/perl5/perlbrew/perls/perl-5.12.2/lib/5.12.2 .) at /home/dave/workspace/proj1/scripts/bin/../lib/createLayout.pm line 14.

I also found the following dir: ~/perl5/lib/perl5/x86_64-linux-thread-multi/auto/IPC/System/Simple but it's empty (I have no idea if this means something).

Was it helpful?

Solution

What does which cpanm from the command line show? For you it should report:

/home/dave/perl5/perlbrew/bin/cpanm

If thats OK then what does ls -l /home/dave/perl5/perlbrew/bin/cpanm show? It should be pointing to:

cpanm -> /home/dave/perl5/perlbrew/perls/current/bin/cpanm

And finally ls -l /Users/barry/perl5/perlbrew/perls/current should be pointing to the Perl you've switched to in perlbrew:

/home/dave/perl5/perlbrew/perls/current -> perl-5.12.2

All three of these must be like this otherwise something is wrong.

If its not then one likely issue is that cpanm is pointing to another installed Perl. You need to have cpanm installed for each version of perl under perlbrew:

perlbrew switch perl-5.12.2
curl -L http://cpanmin.us | perl - App::cpanminus

Now if which cpanm still doesn't show the perlbrew path then you have a $PATH precedence issue in your .bash_profile (or equivalent) file. This can be fixed by making sure that your perlbrew line...

source /home/dave/perl5/perlbrew/etc/bashrc

... in the profile file is after any other export $PATH lines.

After re-login back in you can confirm that this is right by doing echo $PATH and you should see perlbrew at the beginning (the left) of the path string, ie. something like this:

/home/dave/perl5/perlbrew/bin:/home/dave/perl5/perlbrew/perls/current/bin:/usr/bin:/bin:/usr/local/bin:

OTHER TIPS

Try this step-by-step guide, paying close attention to steps 7 and 8 (and optionally 9).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top