develooper Front page | perl.perl5.porters | Postings from March 2023

Re: Managing Perl installations

Thread Previous | Thread Next
From:
Joel Roth
Date:
March 7, 2023 19:14
Subject:
Re: Managing Perl installations
Message ID:
20230307191427.2jtzqoicwr65vekh@sprite
tl;dr plenv seems to be close to what you want 

On Tue, Mar 07, 2023 at 10:57:12AM +0100, Ovid wrote:
> On Tue, Mar 7, 2023 at 10:28 AM demerphq <demerphq@gmail.com> wrote:
> > On Tue, 7 Mar 2023 at 10:02, Ovid <curtis.poe@gmail.com> wrote:

> > > I think the Perl core should consider a solution for this.
> >
> > What is "this" exactly in your mind? A solution to 'Other languages
> > bundle tools which allow you to build and install "per-project."'?
> >
> > You can do that just by running Configure. I have a feeling that you
> > want something more, but im not sure exactly what it is you want.
 
> There are two parts to this that I see. Yes, I can run ./Configure -des
> -Dprefix=$HOME/myperl to install Perl where I want, but perlbrew makes it
> trivial to perlbrew switch current-client.

AIUI perlbrew let you select a global perl version to use, 
allows you to launch a *shell* running a different perl, but
not to specify a perl version for a particular directory.

> Installing modules per project seems a touch more challenging. Having
> something like carton in the code and documented (and suggested) in the
> README would make life safer. I have multiple client projects and I want to
> be able to cd into a directory and have it easy to know:
 
>    1. I'm running the correct version of Perl, along with the correct
>    configuration

Maybe have some sort of file in that directory as an
indicator which perl version to use. plenv uses .perl-version. 

>    2. Even if something else is using that version, my local modules will
>    be picked up in preference to my Perl versions.

plenv-contrib(1) adds commands to set up a local::lib for a
particular perl version. You can launch a shell with a
selected perl-version/local::lib combination. 

  plenv use 5.18.0
  plenv lib create 5.16.3@nobita
  plenv use 5.16.3@nobita

> perlbrew doesn't quite handle the first case. I can run perlbrew install
> $version -as my-version, but unless I've misunderstood, I can't have
> multiple identical versions of Perl with different configurations. plenv
> gives me more freedom, but it's written in bash.

Being written in bash isn't much of an obstacle. It's small,
a hundred lines. The actual installer Build::Perl *does*
take many options, is pure perl, and is accessible through
plenv. 

plenv also makes minimal changes to the environment compared
to perlbrew: just one addition to PATH. 

> Fair 'nuff :)
> 
> What I would love, out of the box is something like this:
> 
>     perl -MInstall::Local -E 'install' *options for configure*
> 
> With that bit of hand-waving, I have a local, per-client Perl, configured
> how the client needs it, and automatically pointing to local (per
> directory) CPAN installations. This allows me to create an isolated setup
> that doesn't risk interfering with another Perl installation or its modules.

plenv might need enhanced if you want to specify the
local::lib for a particular directory. We previously got
this behavior by letting perl load libraries from the
current directory. 

1. https://github.com/miyagawa/plenv-contrib

-- 
Joel Roth

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About