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?
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.
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
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
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.
© 2022 - 2024 — McMap. All rights reserved.
curl -L http://install.perlbrew.pl | bash
- check this page perlbrew.pl – Palpitant