moogyd <
moo...@yahoo.co.uk> writes:
> Hi,
> I am not an expert in Perl, so forgive me if this is a FAQ somewhere that I cannot find.
> Is there something similar to Python virtualenv i.e. I can have
> multiple (local) Perl installations (versions, libraries) in parallel,
> and select which to use.
>
> A quick google shows plenv (
https://github.com/tokuhirom/plenv) and
> plbrew (
https://perlbrew.pl/), and some others (App::VirtualEnv)
>
Hi moogyd,
In terms of Perl installations perlbrew and plenv is almost identical --
they are both wrappers for the `Configure` script so all installations
goes under a specific dir.
The difference is how you use those installations.
Both perlbrew and plenv provide some shell-wrappers that alters PATH
so that whatever the "activated" installation can be found in PATH --
preferrably before system-y paths such as /usr/bin
Both isolate their Perl installations so nothing should be related to
system perl. However, both tool kickstart the Configure script and that
might end up linking to libs under /usr/lib, so those installations
might not be self-contained.
In addition, plenv implements project-local version-switching by
allowing you to put a `.perl_version` file inside a dir, and whenever
you cd to that dir, `perl` becomes whatever that `.perl_version`
specifies. This is realized by having shims which is a shell wrapper
script named exactly `perl` that internally finds the right perl
installation and re-exec the actual `perl`. -- this is no supported by perlbrew.
iirc plenv provides no special isolation for libraries (CPAN modules)
perlbrew provides isolations of different set of libraris (by `perlbrew
lib`). Internally these are done via local::lib and therfore perlbrew
also munge your PERL5LIB var (it would be the best if you leave this var
empt)
In terms of CPAN modules that requires C compiler such as Net::SSLeay,
related librires must exist in the system before that can be compiled
and installed.
I hope that answers your question.