How can I add an externally managed Perl installs to Perlbrew?
I would like to use perlbrew to manage multiple Perl installatio开发者_开发问答ns on my system.
However, in addition to the clean installs from CPAN and the system install, I have a couple of other Perl installs that are tied to specific projects. I would like to be able to switch
to these perls as well.
For example, if I have /opt/SomeApp/perl/bin/perl
with libraries in /opt/SomeApp/perl/lib
, how do I add it to perlbrew?
Perlbrew
does allow you to switch to any Perl it can find in the PATH environment variable. For eg:
export PATH="$PATH:/opt/SomeApp/perl/bin"
perlbrew installed
You should now see /opt/SomeApp/perl/bin/perl
listed as a perl that perlbrew
manages. So now (in the same shell session) you could do:
perlbrew switch /opt/SomeApp/perl/bin/perl
NB. You will probably find that the perlbrew switch ...
works without having to amend $PATH.
/I3az/
perlbrew looks for its perls under the PERLBREW environment variable, but it's also expecting to find more than just your perls under there. It's also managing some state and creating some directories to hold the latest symlinks.
What happens when you make symlinks in your perlbrew directory so it looks like /opt/SomeApp/perl/bin/perl is ~/perl5/perlbrew/perl/SomeApp?
I still think this is a recipe for confusion and disaster, though. Anything that needs a specific installation shouldn't rely on a mutable link.
精彩评论