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?
-
6best is install a whole perl for yorself. `curl -L http://install.perlbrew.pl | bash` - check this page http://perlbrew.pl – clt60 Feb 24 '14 at 06:57
-
Thanks for quick reply jm666. I'm new to linux. Can you please give little more information in detail? – Naghaveer R Feb 24 '14 at 06:59
-
13Probably everything what you need to know is already nicely written in the site: http://perlbrew.pl – clt60 Feb 24 '14 at 07:02
-
2Why 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. – DeVadder Feb 24 '14 at 09:46
3 Answers
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

- 30,738
- 21
- 105
- 131

- 71
- 1
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

- 309,089
- 65
- 217
- 230
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.

- 30,738
- 21
- 105
- 131

- 133
- 4