perlbrew 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.
This article is originally perlbrew - Installation of Perl on User Directries | Perl ABC
Installation of perlbrew
Execute the following command to install perlbrew.
curl -L http://install.perlbrew.pl | bash
If you don't have curl command, use wget command or fetch command.
# Linux wget -O - http://install.perlbrew.pl | bash # FreeBSD fetch -o- http://install.perlbrew.pl | sh
You can also install perlbrew from CPAN.
sudo cpan App::perlbrew perlbrew init
bash
Add the perlbrew settings to "~/.bashrc".
echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.bashrc
Reload "~/.bashrc".
source ~/.bashrc
csh
Add the perlbrew settings to "~/.cshrc".
echo "source ~/perl5/perlbrew/etc/cshrc" >> ~/.cshrc
Reload "~/.cshrc".
source ~/.cshrc
Installtion of Perl using perlbrew
You can check the available Perls using available command.
# Show the available Perls perlbrew available
Let's install a Perl using install command. The latest Perl version for 2022 is v5.34.1.
# Install Perl perlbrew install perl-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 list command.
# Show the list of installed Perls perlbrew list
The installed Perls are displayed.
perl-5.34.1
And switch to the installed Perl.
perlbrew switch perl-5.34.1
And show the installed Perls again.
# Show the installed Perls perlbrew list
"*" is added to the head of the current Perl.
* perl-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.
perlbrew install-cpanm
And install a module.
cpanm JSON
Modules are installed on the following directory in my case.
/home/kimoto/perl5/perlbrew/perls/perl-5.34.1/lib/site_perl/5.34.1/
Returning back to System Perl
If you want to returning back to system Perl, use off command.
perlbrew off
Top comments (0)