1. Perl
  2. Module
  3. here

plenv - Installation of Perl on User Directories

plenv is a command line tool to intall Perl on user directries. You can install any version of Perl on your user directries and use it.

Installation of plenv

Execute the following command to install plenv.

git clone https://github.com/tokuhirom/plenv.git ~/.plenv
git clone https://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/

Next, let's pass the path of plenv. Add the configuration file for bash provided by plenv to ".bash_profile" (for bash).

Execute the following command.

echo 'export PATH="$HOME/.plenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(plenv init -)"' >> ~/.bash_profile
exec $SHELL -l

Installtion of Perl using plenv

You can check the available Perls using install command and -l option.

plenv install -l

If plenv is installed successfully, you will see a list of Perls you can install.

Available versions: Available versions:
 5.35.10
 5.35.9
 5.35.8
 5.35.7
 5.35.6
 5.35.5
 5.35.4
 5.35.3
 5.35.2
 5.35.1
 5.35.0
 5.34.1
  ...

Install Perl in your environment. Let's install Perl of 5.34.1. It will take some time, so wait(about 40 minutes).

plenv install 5.34.1

If the installation of Perl fails, check the following commands are installled. These commands are needed to install Perl.

  • make
  • gcc
  • patch

Show the list of installed Perls using versions command.

# Show the list of installed Perls
plenv versions

When Perl is available

The installed Perls are displayed.

* system(set by /home/kimoto/.plenv/version)
  5.34.1

And switch to the installed Perl using the global command.

plenv global 5.34.1

And show the installed Perls again.

# Show the list of installed Perls
plenv versions

"*" is added to the head of the current Perl.

  system(set by /home/kimoto/.plenv/version)
* 5.34.1

And see the Perl version.

perl -v

The version of current Perl is displayed.

This is perl 5, version 34, subversion 1 (v5.34.1)  built for x86_64-linux

Installation of cpanm

cpanm can be installed using install-cpanm command.

plenv install-cpanm

And install a module.

cpanm JSON

Returning back to System Perl

If you want to returning back to system Perl, switch to system.

plenv global system

Related Informatrion