Why the module installed by `cpanm` will not be recognized?

I installed perl-5.12.2 using perlbrew :

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

Then I 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 directory: ~/perl5/lib/perl5/x86_64-linux-thread-multi/auto/IPC/System/Simple but it's empty (I have no idea if this means something).

+4
source share
2 answers

What shows which cpanm from the command line? For you, he must inform:

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

If so, then what does ls -l /home/dave/perl5/perlbrew/bin/cpanm ? It should indicate:

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

Finally, ls -l /Users/barry/perl5/perlbrew/perls/current should point to the Perl that you switched to perlbrew :

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

All three of them should be like this, otherwise something is wrong.

If this is not one of the probable problems, then cpanm points to another installed Perl. You must have cpanm for each version of perl in perlbrew :

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

Now, if which cpanm still does not show the perlbrew path, you have a problem with $PATH priority in your .bash_profile (or equivalent) file. This can be perlbrew making sure your perlbrew string ...

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

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

After logging in again, you can confirm that this is correct by executing echo $PATH , and you should see perlbrew at the beginning (left) of the path line, i.e. something like that:

 /home/dave/perl5/perlbrew/bin:/home/dave/perl5/perlbrew/perls/current/bin:/usr/bin:/bin:/usr/local/bin: 
+2
source

Try this walkthrough , paying close attention to steps 7 and 8 (and optionally 9).

+3
source

All Articles