Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Multiple Strawberry Perl Versions under Windows

by jmb (Novice)
on Sep 30, 2011 at 18:13 UTC ( #928888=perlquestion: print w/replies, xml ) Need Help??
jmb has asked for the wisdom of the Perl Monks concerning the following question:

Dear Perl Monks,

I would like to use multiple Strawberry Perl versions under Windows.

My understanding is that using the excellent perlbrew tool under windows is not possible, at least for the moment.

Could you please give me some pointers about how to handle this ? More specifically, is there a tool/script to help switching between different Perls, modifying the PATH environment variable ?

All suggestions are welcome !
  • Comment on Multiple Strawberry Perl Versions under Windows

Replies are listed 'Best First'.
Re: Multiple Strawberry Perl Versions under Windows
by ikegami (Pope) on Sep 30, 2011 at 21:29 UTC

    If you can install Strawberry Perl to a directory of your choice, all you need to do is specify the Perl you want when you start your script. Instead of


    Set your PATH and the .pl association to the version you want to use by default. You could even create different associations for different versions. For example, .pl512 could be associated with an installation of Perl 5.12.

    You can also change the PATH within a console and it will only affect what you do in that console.

Re: Multiple Strawberry Perl Versions under Windows
by Kc12349 (Monk) on Sep 30, 2011 at 18:34 UTC

    Repointing strawberry entries in PATH should be all you need to do to achieve this. A simple batch script should suffice. I've managed this on ActiveState perl, though I haven't tried in Strawberry.

    Strawberry also offers some portable distros that may fill the need as well.

Re: Multiple Strawberry Perl Versions under Windows
by VinsWorldcom (Parson) on Oct 10, 2012 at 02:30 UTC

    I use 'junction' in a batch script to achieve this. I installed the latest Strawberry Perl (5.16.1) for Windows 7 in the default directory. Then I just renamed the directory to 'strawberry-5-16'. I created a few new directories in the root:

    cd c:\ mkdir strawberry-5-10 mkdir strawberry-5-12 mkdir strawberry-5-14

    I then grabbed the ZIP versions of the associated Strawberry Perl versions corresponding to the directories and unzipped them directly into their respective directories.

    Finally, to use the Perl I want, I just use the following batch script 'perlreloc.bat'. For example, if I want to use 5.16, I just type:

    perlreloc 5-16

    The script basically creates a junction (like a link in *nix) so c:\strawberry actually points to c:\strawberry-5-16 (in the above example). With this way, you don't need to use the Strawberry relocation script and older versions of Strawberry that don't support relocation will still work because when activated with the batch file, they appear to be running in their default directory - c:\strawberry.


    @echo off REM REM Help REM if {%1}=={/?} goto HELP if {%1}=={--help} goto HELP REM REM Check args REM if not {%2}=={} goto ERROR REM ------------------------------------------------------- if {%1}=={} ( junction c:\strawberry perl -e "print \"$] \@ $^^X\n\"" ) else ( if exist c:\strawberry-%1\perl\bin\perl.exe ( junction -d c:\strawberry junction c:\strawberry c:\strawberry-%1 perl -e "print \"$] \@ $^^X\n\"" ) else goto ERROR ) goto END REM ------------------------------------------------------- :ERROR echo %0: Parameter format not correct 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 c:\strawberry-*') do @if +exist c:\strawberry-%%j\perl\bin\perl.exe echo %%j echo. :END
Re: Multiple Strawberry Perl Versions under Windows
by perlfan (Curate) on Oct 02, 2011 at 23:26 UTC
    Can you use perlbrew under cygwin? Also *nix shell related solutions include Tcl-based Modules might be useful. You're looking for something that is Windows environment specific, not necessarily Perl-on-Windows specific. I can't think of any others, maybe someone else can.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://928888]
Approved by davido
Front-paged by toolic
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2018-05-28 09:08 GMT
Find Nodes?
    Voting Booth?