Install another Perl in Linux?
Asked Answered
A

3

6

In our development environment, another team is using default Perl. So we shouldn't touch it. How do I install another Perl? How do I install Perl modules using CPAN?

Afferent answered 24/2, 2014 at 6:55 Comment(4)
best is install a whole perl for yorself. curl -L http://install.perlbrew.pl | bash - check this page perlbrew.plPalpitant
Thanks for quick reply jm666. I'm new to linux. Can you please give little more information in detail?Afferent
Probably everything what you need to know is already nicely written in the site: perlbrew.plPalpitant
Why was this voted off topic? "are off-topic for Stack Overflow unless they directly involve tools used primarily for programming." I would argue that Perl is in fact primarily used for programming.Berne
M
1

You need to download and install Perl from source. You may download Perl from http://www.perl.org/get.html.

In order to use another cpan from another Perl version you may not type "cpan" due to the fact that your Linux user will execute the default locations. Instead you have to execute your "alternate" cpan with the full alternate path. Execute with root and clear the hidden cpan folder from ".cpan" from user home.

Metaphase answered 24/2, 2014 at 13:49 Comment(0)
W
6

anyenv is a great platform to install local versions of all the great open environments, Perl included:

$ git clone https://github.com/riywo/anyenv ~/.anyenv
$ echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(anyenv init -)"' >> ~/.bash_profile  # change profile if needed
$ exec $SHELL -l

This will set up anyenv. From here, you will install plenv, the Perl environment tool. Each of the environment tools allows you to manage that languages different installed versions.

$ anyenv install plenv

Now we can work with the plenv tool...

List available Perl versions:

$ plenv install --list

Install the Perl 5.18.2 binary:

$ plenv install 5.18.2 -Dusethreads

Change global default Perl to 5.18.2:

$ plenv global 5.18.2

Change local project Perl to 5.18.2:

$ plenv local 5.18.2

Run this command after installing a CPAN module, containing an executable script:

$ plenv rehash

Install cpanm to the current Perl:

$ plenv install-cpanm

Install any modules you need from CPAN with

$ cpanm JSON

I use Carton to manage dependencies within a project and recommend you take a look at it.

Now that you have anyenv, remember you can explore different versions of other languages too. anyenv is a priceless tool.

$ anyenv install --list
Available **envs:
  denv
  jenv
  luaenv
  ndenv
  phpenv
  plenv
  pyenv
  rbenv
Wardell answered 1/3, 2014 at 17:59 Comment(0)
R
3

That's what perlbrew is about.

After installing perlbrew, e.g. via

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

(or App::perlbrew from CPAN), you can use

$ perlbrew install perl-5.18.2
$ perlbrew switch perl-5.18.2
Rutan answered 6/3, 2014 at 8:15 Comment(0)
M
1

You need to download and install Perl from source. You may download Perl from http://www.perl.org/get.html.

In order to use another cpan from another Perl version you may not type "cpan" due to the fact that your Linux user will execute the default locations. Instead you have to execute your "alternate" cpan with the full alternate path. Execute with root and clear the hidden cpan folder from ".cpan" from user home.

Metaphase answered 24/2, 2014 at 13:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.