views:

83

answers:

2

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).

+2  A: 

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

CanSpice
+1 Thanks. Not solved yet (see my comment to draegtun), but hopefully on the way...
David B
+2  A: 

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:

/I3az/

draegtun
I failed at your first question. `which cpanm` shows `/usr/bin/cpanm`. I followed the guide CanSpice linked to, and everything went fine **except** that I can't run `cpan-outdated` (as if it's not installed). I think perhaps `cpanm` was not installed correctly (although I did switch before installing it) since I don't even have `/home/dave/perl5/perlbrew/perls/current/bin/cpanm`. However, the third thing seems fine: `/home/dave/perl5/perlbrew/perls/current -> perl-5.12.2`.
David B
I now note there is a difference between the guide and one of your instructions. compare your `curl -L http://cpanmin.us | perl - --sudo App::cpanminus` and the guide's `curl -L http://cpanmin.us | perl - App::cpanminus`. I can't sudo since my user is not in the admin group. Does it mater? p.s. I can `su`...
David B
Yes `--sudo` not needed when installing under perlbrew (have edited).
draegtun
re: `failed first question`. Yes everything u've mentioned points to not having `cpanm` installed under your perl 5.12.2 that you installed via `perlbrew` and instead its picking up the `/usr/bin/cpanm` which will be connected to the `/usr/bin/perl` which is the perl it would have installed your `IPC::System::Simple` for (each perl on your machine has its own CPAN directory).
draegtun
solved. thank you both guys!
David B