Installation
Copy & paste this line into your terminal.
\curl -L https://install.perlbrew.pl | bash
Then, execute following line:
echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.profile
Then, open new shell and you can start working with perlbrew
in there.
All files will be installed in ~/perl5/perlbrew/
, and it will use that directory and subdirectories.
Basic usage
Get a list of available perls you can use:
perlbrew available
Install some version of perl:
perlbrew install perl-5.36.1
It will compile that perl version and install it within ~/perl5/perlbrew/
subdirectory.
It will take some time (around 21 minutes at my laptop), and it will take 324M of disk space.
Now you can list all installed perl versions:
perlbrew list
To switch to specific version you can use command switch
:
perlbrew switch perl-5.36.1
To execute the script with another version of perl, but not switching to it completely:
perlbrew exec --with perl-5.40.0 perl myprogram.pl
To run the script with specific version of perl from cron, use the following:
* * * * * PERLBREW_ROOT=$HOME/perl5/ ~/perl5/perlbrew/bin/perlbrew exec --with perl-5.36.1 ~/myprogram.pl
For more on cron tips, see: http://johnbokma.com/blog/2019/03/08/running-a-perl-program-via-cron.html
To return back to system perl version, you can switch it off:
perlbrew switch-off
For additional help:
perlbrew -h
perlbrew help
See more: https://perlbrew.pl/
See also: https://github.com/tokuhirom/plenv