3

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

Timelimelim
  • 176
  • 1
  • 11

4 Answers4

1

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.

Timelimelim
  • 176
  • 1
  • 11
1

In my case I was just trying to get some perl code running. Many thanks to the #perl channel on irc.freenode.net.

I first used local::lib but may not have fully cleaned up after using it. The modules I needed for the code I was trying to get running would not run with the system perl. It was just too old.

Then I tried perlbrew install perl-5.20.1 and perlbrew install-cpanm. It felt great to start fresh with a known quantity. Yet I found that modules were passing tests and said they were installing but not getting found and used. Dependencies were trying to be continuously reinstalled. Installing the dependencies one at a time didn't even work. It was baffling. Somewhere along the way I read to set PERL_MB_OPT and PERL_MM_OPT though I think I should have also set PERL5LIB with those.

So I started over with perlbrew after rm -rf ~/.cpan ~/.cpanm ~/perl5. Everything just works now. Hurray!

Grant Bowman
  • 307
  • 6
  • 16
0

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"

davewood
  • 196
  • 8
0

[ I'm going to assume you started a fresh shell (e.g. reopened your terminal or executed exec bash) or sourced ~/perl5/perlbrew/etc/bashrc in your current shell after installing perlbrew ]

Which Perl did you use to install cpanm? cpanm will install modules for the Perl that runs it, which will be the one mentioned on the first line of cpanm if you run it as cpanm ....

Options:

  1. Use cpan instead of cpanm.
  2. Install cpanm using your newly installed Perl.
  3. Use perl -S cpanm ... as a workaround.
ikegami
  • 367,544
  • 15
  • 269
  • 518