in reply to Strawberry Perl, from 5.18 to 5.22
I use the ZIP file to install and just UNZIP into a directory - C:\Program Files\strawberry\strawberry_5.MJ.MN-MSWin32-x64-multithread.
The MJ and MN are the major, minor version numbers. This way I have all versions of Perl in one place and then use 'mklink' in a fancy script (see below) to map C:\strawberry to the version I want to use. It's basically PerlBrew for Strawberry on Windows.
By doing it this way, I never have to change my PATH, which just includes:
C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawrry\perl\bin;
Batch script for changing Perl versions 'plroot.bat':
@echo off setlocal ENABLEDELAYEDEXPANSION set PLPERL=strawberry set PLROOT=%SystemDrive%\!PLPERL! set PLUSER=%USERPROFILE%\perl set PLSTOR=%ProgramFiles%\!PLPERL! REM set PLSTOR=%SystemDrive% REM REM Help REM if {%1}=={/?} goto HELP if {%1}=={--help} goto HELP REM REM Check args REM if not {%2}=={} goto ERROR REM ------------------------------------------------------- perl -v 2>nul>nul if ERRORLEVEL 9009 goto ERROR_INSTALL :NORMAL if {%1}=={} ( dir /al !PLROOT!* 2>nul | find "JUNCTION" > nul if ERRORLEVEL 1 goto INSTALL for /f "tokens=5,*" %%i in ('dir /al !PLROOT!* ^| find "JUNCTION"' +) do @echo !PLROOT! %%j for /f "tokens=5,*" %%i in ('dir /al !PLUSER!* ^| find "JUNCTION"' +) do @echo !PLUSER! %%j echo. perl -e "print \"$] \@ $^^X\n\"" echo. echo Available: for /f "tokens=1,* delims=_" %%i in ('dir /b "!PLSTOR!\!PLPERL!_*" +') do @if exist "!PLSTOR!\!PLPERL!_%%j\perl\bin\perl.exe" echo %% +j ) else ( if exist "!PLSTOR!\!PLPERL!_%1\perl\bin\perl.exe" ( if exist !PLROOT! rmdir !PLROOT! mklink /j !PLROOT! "!PLSTOR!\!PLPERL!_%1" if not exist %userprofile%\perl5\%1 ( mkdir %userprofile%\perl5\%1 ) rmdir !PLUSER! mklink /j !PLUSER! !userprofile!\perl5\%1 echo. perl -e "print \"$] \@ $^^X\n\"" ) else goto ERROR ) goto END :INSTALL echo Installing... pause if not exist %PLROOT% goto ERROR_NOTFOUND for /f %%i in ('perl -MConfig -e "print \"$Config{version}-$Config{arc +hname}\""') do set PERLJUNCDIR=%%i if not exist "%PLSTOR%" mkdir "%PLSTOR%" move %PLROOT% "%PLSTOR%\%PLPERL%_%PERLJUNCDIR%" call :NORMAL %PERLJUNCDIR% goto END REM ------------------------------------------------------- :ERROR echo %0: Parameter format not correct goto END :ERROR_INSTALL echo %0: Perl not installed goto END :ERROR_NOTFOUND echo %0: Perl not found goto END :HELP echo. echo %0 manages different versions of Perl. echo. echo USAGE: echo. echo %0 ^<Perl_version_number^> echo. echo Where ^<Perl_version_number^> is one of the following: echo. for /f "tokens=1,* delims=_" %%i in ('dir /b "!PLSTOR!\!PLPERL!_*"') d +o @if exist "!PLSTOR!\!PLPERL!_%%j\perl\bin\perl.exe" echo %%j echo. :END
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Strawberry Perl, from 5.18 to 5.22
by EigenFunctions (Beadle) on Jul 23, 2015 at 20:57 UTC | |
by afoken (Chancellor) on Jul 24, 2015 at 07:12 UTC | |
by EigenFunctions (Beadle) on Jul 24, 2015 at 17:27 UTC |