开发者

How can make 2 versions of perl run on Windows 7?

I need to run 2 versions of perl on Windows 7.

The first one i开发者_JS百科s bundled with VMware vCLI, it is Active State Perl 5.8.8.

The one I need for script dev is Stawberry 5.12.4 (something like that).

When I type perl -v It calls the AS perl which does not seem to support things like named captures and other things I took for granted in perl.

Both perls are installed I just don't know how to call Stawberry instead of AS perl.

Any idea?


Your specific problem can be addressed by editing the PATH environment variable, as noted by David Heffernan.

System control panel
> Advanced system settings
> Environment variables
> Path
> Edit...

More broadly, here's the general approach I am currently using to manage multiple versions of Perl, Python, etc. on Windows 7. I would appreciate tips for better ways to do this.

I create a Perl installation area like this:

C:\usr\perls\
     5.10\
     5.12\
     etc.

     current # Symbolic link.

In that same area I create a symbolic link (current) referring to the version I want as my default, and I make sure that all Perl references in my PATH environment variable use current rather than specific version numbers.

# Open cmd window as an administrator.
cd C:\usr\perls
mklink /D current 5.12

Under that approach, I can quickly modify my system's default Perl by changing one symbolic link rather than making multiple edits to PATH, which is a more tedious.

In addition, I add a directory to my PATH containing batch scripts to invoke specific Perls.

C:\usr\bin
    perl5.10.bat
    perl5.12.bat
    etc.

Those scripts look like this example:

    @ C:\usr\perls\5.12\perl\bin\perl.exe %*


I'd do this by changing the PATH environment variable. Make it point to the 5.12 version and you may find that the VMware code continues working because it knows where to find it its Perl. If not, make a .bat file that sets PATH to refer to the 5.12 installation and use that to launch into a cmd window from which calls to perl invoke 5.12.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜