8

I have just installed a fresh copy of ubuntu 10.10. I installed perl 5.12.2 following brian d foy's recommended outline and then installed cpanminus by invoking curl -L http://cpanmin.us | perl5.12.2 - --sudo App::cpanminus.

Now, cpan5.12.2 works fine, but whenever I try to install a module using cpanm5.12.2 it fails finding it. e.g.:

$ sudo cpanm5.12.2 -v File::Copy::Recursive
You have make /usr/bin/make
You have LWP 5.837
You have /bin/tar: tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching File::Copy::Recursive on cpanmetadb ...
! Finding File::Copy::Recursive on cpanmetadb failed.
Searching File::Copy::Recursive on search.cpan.org ...
! Finding File::Copy::Recursive on search.cpan.org failed.
! Couldn't find module or a distribution File::Copy::Recursive
Community
  • 1
  • 1
David B
  • 29,258
  • 50
  • 133
  • 186
  • Can you install with the normal cpan? – brian d foy Oct 17 '10 at 22:59
  • 2
    Do you have any sort of proxy? Does `perl -wle 'use LWP::Simple; getprint "http://cpanmetadb.appspot.com/v1.0/package/File::Copy::Recursive"'` return a YAML file? – Schwern Oct 18 '10 at 01:34
  • @brian d foy: yes, as mentioned - cpan5.12.2 works fine. – David B Oct 18 '10 at 07:10
  • @Schwern I do use a proxy. Your command returns `--- distfile: D/DM/DMUEY/File-Copy-Recursive-0.38.tar.gz version: 0.38`. – David B Oct 18 '10 at 07:11
  • 1
    That's what its supposed to return, but is `perl` the same as `perl5.12.2`? Try it again with `perl5.12.2`. I suspect the proxy is interfering. You have an HTTP_PROXY or http_proxy environment variable set? LWP should detect that and use it. – Schwern Oct 18 '10 at 13:31
  • @Schwern: yes, `http_proxy` is defined. `perl` points to the default perl thae came with ubuntu 10.10 (per 5.10.1), while `perl5.12.2` points to... well, you know what. – David B Oct 18 '10 at 18:58
  • I'm actually having the same problem but I'm not sure if the cause is the same or not. When I run the LWP::Simple command that Schwern gives I get `Use of uninitialized value in subroutine entry at /home/mpeters/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/XSLoader.pm line 95. 501 Attempt to reload IO/Socket.pm aborted.` Something's wrong with my XSLoader on this perl (most of my perlbrew installed perls, but not all). It's pretty weird. – mpeters Feb 14 '13 at 14:42

2 Answers2

2

You might try using perlbrew to install a custom perl intrepreter. Then you can activate your 5.12.2 version, install cpanm (no sudo required) and install your modules as a normal user eg. "$ cpanm My::Module"

By using this method, you get custom cpanm binaries tied to each specific perlbrew version. You have to install cpan modules for every perlbrew version, but you don't end up with binaries like "cpanm5.12.2" but rather "cpanm". Perlbrew takes care of setting up a perl-version-specific path, which is rather handy IMHO.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Drew Taylor
  • 514
  • 4
  • 6
1

I had the same problem. LWP uses $HTTP_PROXY rather than $http_proxy on my machine.

If you specify something for $http_proxy without the protocol (in my case, I was missing http:), it will complain but seems misleading as it doesn't actually find the missing packages.

Steven
  • 11
  • 1
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). – Gauthier Boaglio Jun 03 '15 at 04:23
  • His concern is that he is not able to install a module and from what I understand, the cause of the problem is that he is behind a proxy. He explains that he has the `http_proxy` environment variable set, and I am proposing using `HTTP_PROXY` as the solution. – Steven Jun 11 '15 at 13:58
  • This solution worked for me. I was trying to install a package (Dancer2) and had the same error, but had forgotten to export the proxy settings. – Kevin Teljeur Oct 27 '16 at 08:46