The stupid question is the question not asked | |
PerlMonks |
Common module lib across Perl versions on same systemby VinsWorldcom (Prior) |
on Jan 18, 2017 at 20:45 UTC ( [id://1179871]=perlquestion: print w/replies, xml ) | Need Help?? |
VinsWorldcom has asked for the wisdom of the Perl Monks concerning the following question: I've done a bit of searching, but I'm not getting the right results so thought I'd pose the question here. I use Strawberry Perl on Windows and have a few different versions installed (5.8, 5.14, 5.18 32/64, 5.22). I manage them with a simple batch script that changes a directory junction from C:\strawberry to the appropriate Perl. Works great. HOWEVER, when I switch from one to another, I "lose" all my modules - as expected. In other words, when I CPAN install a non-core modules to version 5.14 for example, when I switch to version 5.18, it isn't there - no shocker. ... But could it be? For some pure-perl modules, there should be *no* issue providing there are no backward-compatibility, new feature enhancements used. It'd save a bunch a time installing the same module 5 times for each of my 5 versions. I do have a %USERPROFILE%\perl directory and 'set PERL5LIB=%USERPROFILE%\perl\lib' in Command Prompt environment variables. But are there implications? I'd install in 1 version of Perl so that CPAN database gets updated, but the other 4 wouldn't - what craziness could ensue? Has anyone done this or is there a better way that I'm missing? My searching keeps turning up local::lib - which is bundled in vendor/lib with Strawberry, but this sounds like what I'm already doing with PERL5LIB. UPDATE: So I tried it - created a %USERPROFLE%\perl and %USERPROFLE%\perl5 directories. %USERPROFLE%\perl5 is a symlink (mklink in Windows) to a subdirectory in %USERPROFLE%\perl:
I set PERL5LIB:
Now for common pure Perl modules I want to share across all versions and I know will work on all versions, I install with:
... and it gets installed to %USERPROFILE%\perl, which has the ..\perl\bin in my %PATH%. Tested and it works fine. Not sure of the future implications of this or if it's really the way to go. I don't use Perl all that often, but I do maintain a few modules and like to have different Perl version to test them on. Now instead of installing multiple copies of the same module into different Perl site directories, I install it once in a common place and all Perls can run against it and test. Limited use case, just wondered how other developers more experienced than I would handle something like this.
Back to
Seekers of Perl Wisdom
|
|