Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error locating modules using perlbrew and cpanm

I want to use perlbrew and cpanm on my machine. I installed perlbrew like this

curl -L http://install.perlbrew.pl | bash

and sourced ~/perl5/perlbrew/etc/bashrc in my .bashrc. Next I installed perl v5.21.5 and switched to this version.The which perl command points to my perlbrew installation. The same is true for cpanm.

But when I install a perl module like cpanm Mojo Neither the binaries are installed nor the includes can be located. But all tests pass. I looked under ~/perl5/ and could not find the sources. Does anyone had the same issue before? I may have used cpan on my Ubuntu 14.04 before. May this cause any problems? How can I figure out where cpanm put the module?

BTW: I'm using perlbrew version 0.71

like image 253
Timelimelim Avatar asked Sep 17 '25 02:09

Timelimelim


2 Answers

Are you running the cpanm command in a new terminal window by chance, if so it might not use the new perl you brewed.

"perlbrew use" only makes the current shell use the brewed perl whereas "perlbrew switch" makes all new shells of the current user use the selected perl.

You should provide the output of "perl -V" and "perlbrew info"

Here is a tip how you can find where cpanm installed a module:

1) install locate (sudo aptitude install locate)

2) run "sudo updatedb" (creates the index used by locate)

3) run "locate Mojo" to see where the files have been created.

Also interesting would be to know which cpanm binary you are using. "which cpanm"

You can install a perlbrew-wide cpanm with "perlbrew install-cpanm"

like image 171
davewood Avatar answered Sep 19 '25 08:09

davewood


I solved the problem by deleting everything perl-related in my home directory. The folder ~/.cpan had write-proteced files. Only the sudo user could delete them. I assume I used cpan as root in the past. In addition I deleted ~/.cpanm and ~/perl5. After reinstalling perlbrew, perl and mojolicious, everything worked out of the box.

like image 26
Timelimelim Avatar answered Sep 19 '25 07:09

Timelimelim