by Scott, Revised on July 31, 2017 (Linux, Open Source, Perl)
Perlbrew is a tool to install (compile) Perl, or many versions of Perl, into a user's home directory independent of the system Perl and package manager and switch between them. Instructions are found on the website. The actual Perl module is App::perlbrew. A few basic commands after install are:
wget -O - http://install.perlbrew.pl | bash echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.bashrc perlbrew available perlbrew install perl-5.26.0 perlbrew list perlbrew switch perl-5.26.0 perlbrew help perlbrew install-cpanm
Compile a new version and reinstall modules on previous install.
perlbrew install perl-5.26.0; perlbrew list-modules | perlbrew exec --with perl-5.26.0 cpanm
Uninstall if needed.
perlbrew uninstall perl-5.18.4
The difference between "available" and "list" is that the first is a list of Perl versions available to install, while the second is a list of what is installed on the current system.
Cronjobs and the Perlbrew Environment
Cronjobs can run under a user account, but if a Perl script is run directly as a cron, it will use the system Perl. To use the Perlbrew Perl, I run them from a Bash script that sets up the Perlbrew environment.
#!/bin/bash export PERL5LIB=~/perl5/lib/perl5 export PERLBREW_ROOT=~/perl5/perlbrew export PERLBREW_HOME=~/.perlbrew source ~/perl5/perlbrew/etc/bashrc exec ~/cronjobs/$1
Tags: Linux, Open Source, Perl