Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

To kickstart my development work on a Windows 7 box last spring, I installed Git (git v 1.7.0.2.msysgit.0). This installed the awesome GitBash mingw32 window. AFAIK, this git dist installed perl v5.8.8 into expected areas.

I am trying to get the best perl script ever working.

$ ./thebestscript.pl Can't locate XML/XPath.pm in @INC (@INC contains: /usr/lib/perl5/5.8.8 +/msys /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/msys /usr/l +ib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl .) at ./thebestscri +pt.pl line 40. BEGIN failed--compilation aborted at ./thebestscript.pl line 40.

OK, this is the same @INC problem posted earlier. ppm wasn't part of that distribution, so I installed perl v 5.12.4 msi. I carefully pre-pended my PATH to find Perl64/site/bin and Perl64/bin and

export PERL5LIB=/c/prog/Perl64/site/lib:/c/prog/Perl64/lib

Now watch:

$ ppm Perl lib version (5.12.4) doesn't match executable version (v5.8.8) at + /c/prog/Perl64/lib/Config.pm line 50. Compilation failed in require at /c/prog/Perl64/lib/ActivePerl/PPM/Cli +ent.pm line 4. BEGIN failed--compilation aborted at /c/prog/Perl64/lib/ActivePerl/PPM +/Client.pm line 4. Compilation failed in require at /c/prog/Perl64/bin/ppm line 6. BEGIN failed--compilation aborted at /c/prog/Perl64/bin/ppm line 6.

I am not savvy enough to understand how to either get rid of the v5.8.8 without breaking whatever installed it or depends on it, or to get v5.12.4 to ignore the existence of the other one? Thanks in advance.

Replies are listed 'Best First'.
Re: 2 perl distributions on Windows 7
by chrestomanci (Priest) on Aug 18, 2011 at 13:05 UTC

    You can't mix binary perl modules between major versions of Perl (or between processor architectures) To get XML::XPath working in your perl 5.12.x install you will need to separately install the same module there.

    To keep the two perl installs separate, I suggest you create some batch files (named perl_58.bat and perl_512.bat) that setup the environment for each perl. You should not need to explicitly set PERL5LIB for correctly installed CPAN modules.

    If it sounds like to much work to maintain two separate perl installs, then an alternative would be to configure git to use your perl 5.12 install.

      Thank you for responding. I think maintaining two environments would be fine, your idea of separate batch files is spot-on.... but any ideas how to force the 5.12 ppm to not know that 5.8 is around? I was horrified to see how (5.12) ppm somehow could tell that 5.8 existed. (And I can't tell if it matters that I'm working from a GitBash window, the reason for 5.8 to be around in the first place.)

        but any ideas how to force the 5.12 ppm to not know that 5.8 is around?

        Clearing the PERL5LIB environment variable should take care of that.
        As it stands, I think your 'ppm' is loading perl-5.12.4 - and perl-5.12.4 is finding the 5.8.8 Config.pm (because of the PERL5LIB setting).
        That 5.8.8 Config.pm correctly reports that the perl executable is version 5.8.8 ... and you get that mismatch error that you reported.
        Remove that PERL5LIB setting and all should be fine.

        Cheers,
        Rob