Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perl Virtual Environments

30 views
Skip to first unread message

moogyd

unread,
Jan 9, 2021, 2:55:41 AM1/9/21
to
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)

Can anyone provide any experiences and comments, considering that I am not expert in the details of Perl (libraries, paths, cpan).

Thanks in advance,
Steven

Rainer Weikusat

unread,
Jan 10, 2021, 3:02:27 PM1/10/21
to
moogyd <moo...@yahoo.co.uk> writes:
> 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.plF/), and some others (App::VirtualEnv)
>
> Can anyone provide any experiences and comments, considering that I am
> not expert in the details of Perl (libraries, paths, cpan).

Both of these are just wrappers for existing facilities: It's possible
to specify the set of library directories etc of a perl version when
configuring a source tree for compiling it. Hence, there can as many
different version of Perl coexisting on the same system as one wants to
use.

Kang-min Liu

unread,
Jan 21, 2021, 9:17:05 PM1/21/21
to
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.

0 new messages