perlbrew 0.31 is a rather experimenting release with these major changes, please fully read this release note before upgrading.
perlbrew mirror
perlbrew help <command>
now displays brief documentation for the command.
--root
argument for all commands that can be used as a quick alternative to set PERLBREW_ROOT env var.
perlbrew list
If you ever used perlbrew mirror
to choose mirror sites, you need to re-run
perlbrew mirror
after installing this release.
There are demands to invoke perlberw commands from shell scripts, crontab or anywhere that is not an interactive shell. perlbrew has been improving to make it easier to run commands from a shell script. One of the biggest hassle is the requirement of PERLBREW_ROOT environment variable.
Almost all perlbrew commands now recognize a --root
arg and treat its value as
a path of perlberw root dir. For example, you can run these command to install
perls into different locations:
/usr/local/bin/perlbrew --root /usr/perls install 5.14.2
/usr/local/bin/perlbrew --root /opt/perls install 5.14.2
/usr/local/bin/perlbrew --root /mnt/perls install 5.14.2
Full path to perlbrew is used in the example to denote that it is not invoking
perlbrew
bash function.
The perlbrew root dirs need to be a previously initialized directory, but you may do so with:
/usr/local/bin/perlbrew --root /usr/perls init
/usr/local/bin/perlbrew --root /opt/perls init
/usr/local/bin/perlbrew --root /mnt/perls init
In this case, it is not mandatory to follow the on-screen instruction to include the bashrc/cshrc in you shell at all.
A small caveat for the exec
command with --root
arg: put --root
arg before
the word exec
like this:
/usr/local/bin/perlbrew --root /mnt/perls exec myprog.pl --arg value
Since it is expected that every words after exec
are the actual command to run.
General rule of thumb: put --root
arg right after perlbrew
when you need to
specify it.
However, if you need to invoke use
or switch
command from your shell script,
it is still required to include the perlbrew bashrc file in your shell script.
Without doing so, they spawn a sub-shell process, which is never a desired
outcome.