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:

VinsWorldcom@C:\Users\VinsWorldcom> ls perl Directory of C:\Users\VinsWorldcom\perl [.] [bin] [..] [5.08.8-MSWin32-x86-multi-thread] [lib] [5.18.1-MSWin32-x64-multi-thread] [5.18.2-MSWin32-x86-multi-thread] [5.22.2-MSWin32-x64-multi-thread] 2 File(s) 7,449 bytes VinsWorldcom@C:\Users\VinsWorldcom> ls -al [...] 01/19/2017 07:52 AM <JUNCTION> perl5 [C:\Users\VinsWorldcom\pe +rl\5.18.1-MSWin32-x64-multi-thread]


PERL5LIB=C:\Users\VinsWorldcom\perl5\lib;C:\Users\VinsWorldcom\perl\li +b

Now for common pure Perl modules I want to share across all versions and I know will work on all versions, I install with:

cpan -j C:\Users\VinsWorldcom\perl\ Module::Name

... 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.