1

I am a brand new perl user attempting to install perl modules and their dependencies.

I am trying to install the perl dependencies I need on a fresh Ubuntu 16.10 cloud server instance but they do not register as installed.

For example

cpanm --skip-installed LWP::Simple

shows

--> Working on LWP::Simple
Fetching http://www.cpan.org/authors/id/O/OA/OALDERS/libwww-perl-6.21.tar.gz ... OK
Configuring libwww-perl-6.21 ... OK
==> Found dependencies: WWW::RobotRules, Net::HTTP, File::Listing, HTTP::Daemon, Test::RequiresInternet, Test::Fatal, HTTP::Negotiate, HTTP::Cookies
--> Working on WWW::RobotRules
Fetching http://www.cpan.org/authors/id/G/GA/GAAS/WWW-RobotRules-6.02.tar.gz ... OK
Configuring WWW-RobotRules-6.02 ... OK
Building and testing WWW-RobotRules-6.02 ... OK
Successfully installed WWW-RobotRules-6.02
--> Working on Net::HTTP
Fetching http://www.cpan.org/authors/id/O/OA/OALDERS/Net-HTTP-6.13.tar.gz ... OK
Configuring Net-HTTP-6.13 ... OK
Building and testing Net-HTTP-6.13 ... OK
Successfully installed Net-HTTP-6.13

...

! Installing the dependencies failed: Module 'File::Listing' is not installed, Module 'HTTP::Daemon' is not installed, Module 'Test::RequiresInternet' is not installed, Module 'HTTP::Cookies' is not installed, Module 'Test::Fatal' is not installed, Module 'HTTP::Negotiate' is not installed, Module 'WWW::RobotRules' is not installed, Module 'Net::HTTP' is not installed
! Bailing out the installation for libwww-perl-6.21.
8 distributions installed

Am I using the right tool? Where can I find or produce more detailed error logs?

Below are selections from my install procedure, but experimentation might mean it is not precisely representative.

sudo apt-get install unzip make cmake perl build-essential curl cpanminus
cpanm --self-upgrade --sudo
sudo ln -s /usr/bin/unzip /bin/unzip
export PERL_INSTALL_ROOT=/home/ubuntu/perl5
export PERL5LIB=/home/ubuntu/perl5
export PERL_CPANM_OPT="--local-lib=/home/ubuntu/perl5"
mkdir -p /home/ubuntu/perl5
chown -R ubuntu:ubuntu /home/ubuntu/perl5
chown -R ubuntu:ubuntu /home/ubuntu/.cpanm
cpanm --local-lib=/home/ubuntu/perl5 local::lib && eval $(perl -I /home/ubuntu/perl5/lib/perl5/ -Mlocal::lib)
cpanm File::Copy::Recursive
cpanm Archive::Zip
cpanm --skip-installed LWP::Simple
  • When that happens to me, I just tell cpanm to install the missing dependencies directly one by one, then afterwards do the main one again. I don't know why it happens though. – simbabque Feb 23 '17 at 21:39
  • When I tried that myself I hit dependencies of those dependencies failing to install. I managed to break cpanm on the first server so I can no longer reproduce, but a fresh server actually worked so I'm moving on. – Bennett Wineholt Feb 23 '17 at 21:57
  • 1
    Personally, I find [perlbrew](https://perlbrew.pl/)/[plenv](https://github.com/tokuhirom/plenv) to be much easier than messing with local::lib. – ThisSuitIsBlackNot Feb 23 '17 at 22:40
  • Also with regard to **general procedure**, I try use the modules that are packaged up for Debian style distributions `libwww-perl` etc. rather than use cpan. This means that they are in the package registry. Clearly, if you are building for a specific user, this does not apply though. – Hugh Barnard Feb 26 '17 at 17:16

1 Answers1

0

On a fresh server this procedure worked

sudo apt-get update
sudo apt-get install unzip make cmake perl build-essential curl cpanminus
echo $?
sudo ln -s /usr/bin/unzip /bin/unzip
mkdir -p /home/ubuntu/perl5
chown -R ubuntu:ubuntu /home/ubuntu/perl5
cpanm --local-lib=/home/ubuntu/perl5 local::lib && eval $(perl -I /home/ubuntu/perl5/lib/perl5/ -Mlocal::lib)
echo "cpanm --local-lib=/home/ubuntu/perl5 local::lib && eval $(perl -I /home/ubuntu/perl5/lib/perl5/ -Mlocal::lib)" >> /home/ubuntu/.bashrc
cpanm File::Copy::Recursive
cpanm --skip-installed LWP::Simple
echo $?