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

Re: Managing Perl installations

Thread Previous | Thread Next
From:
Kang-min Liu
Date:
March 7, 2023 10:29
Subject:
Re: Managing Perl installations
Message ID:
F8DD6BCC-18FD-4F98-AD70-50CCAEA6B4CE@gugod.org
於 2023年3月7日 下午6:57:12 [GMT+09:00],
> 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
>



I've been non-decisive about whether such feature should be part of perlbrew, or be left as an exercise of its users.

At some point `rvm` (for ruby) defines a `cd` shell function that are able to auto-switch to project-specific version of ruby installation whenever you `cd` into some ruby project dir, and undo so whenevere you cd out of it.

 I found this a great idea, but not something I wish to do for once reason -- I do  projects in multilpe programming languages and if several of those tools redefine `cd`... I doubt that I could still have a workable shell in front of me.

I imagine a more workable, non-intrusive, solution is something like this

1. Add `.bin` to $PATH (relative path)
2. Add `.bin/perl` that is a shim script, in which PERL5LIB, PATH, and other envs are tweaked and eventually a line of `exec perl` at the end.

 Having relative path in $PATH is probably  as contraversial as `curl | bash` though.


OTOH if it's ok not to make it looks `magic`, I don't see why we couldn't put a copy of relocatable perl under ".local/bin/perl" and have some basic, per-project shell wraper for tweaking envs.

--
Kang-min Liu

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