more useful options PerlMonks

### Perl on Windows 10

by kcott (Bishop)
 on Jun 21, 2019 at 01:27 UTC Need Help??

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

I've been using macOS (formerly Mac OS X) for almost a decade; I'm moving to Windows 10 in the near future. In the past I did use MSWin — last version was Windows XP — but what I remember of this is probably out of date. I'm looking for advice from anyone currently using Perl on Windows 10. I've added information on some areas that I've already looked at: please expand upon, correct, or otherwise comment on what I have written. There's possibly other areas I've potentially overlooked: again, please add and comment as appropriate.

Firstly, I'm thinking Strawberry Perl is a solid starting point. I did use this long ago; I've generally seen positive comments about it; and, it seems to be up-to-date (I note it has v5.30.0).

I see Strawberry Perl includes MinGW. I do want a command line interpreter and MSYS (which I did use long ago) seems to be appropriate for this; although, as far as I can see, Strawberry Perl doesn't include this. I've also used Cygwin in the past: any comments on this. Another possible option I came across was Interix: this is completely new to me; comments welcome.

I currently use Perlbrew to avoid the System Perl and allow swapping between different versions of Perl (I typically use the latest Perl for personal work; my current $work contract requires an earlier version; and, from time to time, I want to compare code under different versions). The System Perl issue is irrelevant with MSWin; however, I'll still want multiple versions of Perl to be available. Any thoughts on this would be appreciated. Another area I'm completely ignorant about is Windows 10 System Administration privileges and how they might relate to installing or running Perl. Any advice on that would be great. Thanks in advance for any advice, information and comments. — Ken Replies are listed 'Best First'. Re: Perl on Windows 10 by soonix (Canon) on Jun 21, 2019 at 02:22 UTC Interix is now WSL (Windows Subsystem for Linux). I don't remember the exact incantation, you have to install the "feature", which contains the kernel, then add the Userland (e.g. Ubuntu) like it were an application. Bash and Perl (which would then be the system Perl) included. Git, if needed, has to be installed (apt-get). Another possibility is Git for windows, which includes both a bash and Perl, I think based on MSYS. I use Strawberry's portable editions (no bash included) and Conemu, but since you know and use Perlbrew, you'll probably prefer Berrybrew. You need to be an administrator for installation, but not for running. Portable Strawberry needs no "installation", so no admin privileges. Of course, if you use it for administration functions, that's another can of worms :-) G'day soonix, Thanks for the info on Interix. I'm currently leaning towards MSYS2, as suggested by syphilis, but will wait for other responses before making a decision. Yes, Berrybrew looks good. See my response to stevieb's post. — Ken Re: Perl on Windows 10 by syphilis (Bishop) on Jun 21, 2019 at 03:11 UTC Hi, Using Cygwin in the past is fine, but I don't see any need to use it in the present. My advice would be to start withStrawberry Perl and MSYS2 and look no further until they fail to provide something that you need. (And if they don't provide something that you need, ask about it. It might simply be that you weren't looking hard enough.) Cheers, Rob I really don't think putting strawberry perl and msys2 together is a good idea. If you need something provided from msys2 while using perl in windows, most of time, strawberry perl has already provided. If not, you probably need a visual studio or msys2 I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction G'day xiaoyafeng, Thanks for your input. I'm going to start with Strawberry Perl first, then see if I do, in fact, need anything else. See syphilis' post, and my reply to that, for more. — Ken Thanks, Rob. MSYS2 is new to me. I spent a bit of time reading the doco - it looks like it provides the functionality I'm after. I see some (almost) identical packages in both of those. There seems to be quite a few. As an example, Strawberry Perl has binutils-2.32 and MSYS2 has binutils 2.30-1. Are there conflicts with any of these? If so, what's the best way to handle them? Is there a preferred (or even required) installation order? As I'll be installing multiple versions of Perl, installing MSYS2 first seems right to me but I am completely guessing about that. It may be that I just need to read more (or different) doco. I'm happy to follow a link and read if that's easier than a written explanation of any of the above questions. — Ken As an example, Strawberry Perl has binutils-2.32 and MSYS2 has binutils 2.30-1 I avoid having a gcc toolchain installed on MSYS2. If I need a compiler inside MSYS2's msys2_shell.cmd shell (as is often the case), I use a mingw-w64 port of gcc (eg the one provided by Strawberry Perl). I was thinking you'd be using MSYS2 mainly for git, but it's also handy for building C/C++ libraries and for providing 3rd party libraries - eg Gtk2/Gtk3/Gnome, that can be utilized to build the Gtk2/Gtk3/Gnome perl modules on Win32 perls (including Strawberry Perl). I've been doing that sort of stuff for so long now that I had quite forgotten that mixing Strawberry Perl and MSYS2 can also be a bit tricky. Thanks to xiaoyafeng for reminding me that one has to be a little mindful of how the path is set on those occasions when both MSYS2 and Strawberry Perl environments need to intersect. It's hard to come up with a general plan to cover all eventualities, but I think a good start is to set things up so that the default Windows path includes neither MSYS2 nor Strawberry Perl. Then you can just bring in bits and pieces of each, as needed for the particular task. Cheers, Rob Re: Perl on Windows 10 by Discipulus (Abbot) on Jun 21, 2019 at 07:39 UTC Hello kcott, You had already a lot of good suggestions, among them MSYS2 which is new to me and I want to explore too, so I just add a few considerations. Strawberry Perl is an optimal choice: I'm happy with this since many years. I always opt for the portable edition which comes with portableshell.bat launcher that simply launch an appropriate ENV without messing with the system. Obviously Windows has no a System Perl, but anyway using berrybrew can be useful to have different distro installed: personally I use a homegrown solution, still to be published, but the only important thing is (in case you need custom launchers) is to always prepend strawberry paths to everything: c:\strawberryXX\perl\site\bin; c:\strawberryXX\perl\bin; c:\strawberryXX\c\bin; .... Personally, in my custom application, I use UnxUtils to have a bounch of friendly commands available in the prompt. Also gnuwin32 proved to be useful and robust. Dunno what you really intend with command line interpreter. About git I use git CMD but I'm used to have a separate window for this. CAVEAT as you left windows OSs at XP era you might be interested in new traps included in newer OSs. Mostly FileSystem Redirection. See this article, this post of mine this other one about registry Redirection and this one too. All this posts and others are available in my bibliotheca dedicated section. In summation: if something is 32 bit you will be redirected, as you can see: perl -v This is perl 5, version 28, subversion 0 (v5.28.0) built for MSWin32-x +86-multi-thread-64int perl -e "opendir my$dir,'c:/windows/system32'; my $files; while (my$
+ele= readdir($dir)){$files++ } print qq(found $files elements in syst +em32\n)" found 3001 elements in system32 perl -v This is perl 5, version 26, subversion 0 (v5.26.0) built for MSWin32-x +64-multi-thread perl -e "opendir my$dir,'c:/windows/system32'; my $files; while (my$
+ele= readdir($dir)){$files++ } print qq(found $files elements in syst +em32\n)" found 4576 elements in system32 [download] L* There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS. G'day Discipulus, Yes, I think I'm pretty much sold on Strawberry Perl. For the command line interpreter I'm looking for an xterm (or equivalent) running bash with all the usual cd, ls, grep, ln, etc. commands. I use utilities like tar, vim, make, ssh, git, and so on. I'd want to run my own Perl programs and Bash scripts; and, from time to time, code I've written in other languages. All of those are just non-exhaustive examples. Overall, I'd say nothing particularly out of the ordinary. Thanks for the links on "FileSystem Redirection" which I've followed. I also had a brief look at your "bibliotheca" — only followed a few of those links. — Ken If you install git (standard download from git-scm.com), you get "git-bash" (an MSYS based GNU bash), and a perl is included (which could be seen as a "system perl"). Calling the portableshell.bat of a portable Strawberry from git-bash seems to work in principle (perl -v gives the Strawberry's version instead of git-bash's), but seems to mess with keyboard settings (arrow-up and down move the cursor/send control characters instead of browsing through the CLI history). I assume one could convert the BAT file into a shell script, which would mitigate this. Perlbrew on Windows 10 by soonix (Canon) on Jun 21, 2019 at 08:16 UTC Google and Duckduckgo tell me upon searching for "WSL Perlbrew", that there have been successful attempts (however, Perlmonks seems to be consulted only when there are problems :-)) Reports and instructions about success are e.g. here and from the Swiss Perl Workshop 2018. I'm currently trying it out and it looks promising. Update: had to skip tests for installing Perl under perlbrew. Same problem as before, IO::Socket, Net::Ping and companions have failing tests. Thanks for the additional information; however, at this point in time, I'm pretty much sold on Strawberry Perl using Berrybrew in favour of Perlbrew. — Ken Re: Perl on Windows 10 by stevieb (Canon) on Jun 21, 2019 at 02:54 UTC I vote for berrybrew. It's extremely similar to Perlbrew, but uses Strawberry Perl for Windows as its Perl instances. Initial configuration, as well as switching between Perl versions requires administrative privileges, thanks to how Microsoft manages the PATH environment variables. Using Perl afterwards though doesn't require admin privileges. Thanks, Steve. I had a look at the doco. This does seem similar to Perlbrew; so hopefully a gentle learning curve. Installation and configuration look pretty straightforward too. The new computer will be mine alone. No SysAdmin folks to deal with. I don't envisage a problem with the administrative privileges. — Ken Re: Perl on Windows 10 by siberia-man (Pilgrim) on Jun 21, 2019 at 08:01 UTC I can't say anything regarding Perl on Win10 because I am still on Win7. I just want to add my 5 cents for the task of using different versions of any tools. I keep applications (as much as it is possible) in their own directories and create symlinks as below: mklink /d perl strawberry-perl-5.16.2.1-32bit [download] and the c:\full\path\to\perl\bin is specified in the %PATH% variable. When I need to switch to another Perl version I simply change the symlink rd perl mklink /d perl strawberry-perl-5.8.8.3 [download] G'day siberia-man, Good advice: I use ln -s extensively on *nix platforms so I'm familiar with the concept. I'm assuming mklink and rd are MSWin commands. Hopefully, with whatever command line interface I choose, I'll be able to continue using the *nix commands. — Ken Re: Perl on Windows 10 (Why macOS to MSWin?) by kcott (Bishop) on Jun 24, 2019 at 05:38 UTC I see a number of posts querying why I'm changing from macOS to MSWin. I'll provide one complete answer here and point to this in responses to these posts. Firstly, this is a done deal. The hardware and software have been ordered, paid for, and I'm currently awaiting delivery. If this was a terrible decision, then I will have learned a rather expensive lesson; however, at this stage I'm past the point of no return. This wasn't a philosophical decision. I've been using UNIX-style OSes since the '80s and, if Linux (or similar) fulfilled my needs, that's the direction in which I would have gone. I have a number of personal projects which only work — or, at least, work to the level I require — on MSWin. Some are newer projects where I've found macOS lacking; some are older projects which I used to run under MSWin but have been found to be suboptimal under macOS. I'm a programmer by trade and work remotely from home. My "play" computer is also my "work" computer. For the most part, I ssh to a company machine and work on that; the OS from which I run ssh makes little difference. However, there are some projects that require applications that run on an MSWin platform: RDP solutions are slow and have other annoyances; running these applications locally would be a boon. I don't believe there's a perfect solution here. I've simply picked that which I think will work best for my specific requirements. I appreciate that other people's requirements will differ and other solutions will work best for them. — Ken Re: Perl on Windows 10 by shmem (Chancellor) on Jun 21, 2019 at 12:37 UTC I've been using macOS (formerly Mac OS X) for almost a decade; I'm moving to Windows 10 in the near future. This reminds me of an old irish joke Q: "could you tell me the way to Tipperary?" A: "well, I wouldn't start from here..." perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
Re: Perl on Windows 10
by ikegami (Pope) on Jun 26, 2019 at 08:30 UTC

I see Strawberry Perl includes MinGW. I do want a command line interpreter and MSYS (which I did use long ago) seems to be appropriate for this

I think you misunderstand a few things.

• MSYS is unix emulation environment. (Cygwin is another one.)

• MinGW is a port of gcc (and other GNU tools) for Windows (not MSYS).

• Strawberry Perl is a Windows build of Perl. It uses MinGW, not MSYS. (Same goes for ActivePerl.)

• If you're using MSYS, you'd best use an MSYS build of Perl. (Similarly for Cygwin.)

• If you're using Windows, you'd best use Strawberry Perl (or ActivePerl).

G'day ikegami,

"I think you misunderstand a few things.

I think you're right. :-)

As it's been almost a decade since using MSWin, this was probably a case of not knowing what questions to ask. Thanks for the clarifications: your post really helps.

— Ken

Re: Perl on Windows 10
by karlgoethebier (Abbot) on Jun 21, 2019 at 08:42 UTC
"... using macOS ... for almost a decade ... moving to Windows 10..."

Don't do that. For God's sake. Drink a little drink and smoke a little smoke and rethink your decision. Please!

Best regards, Karl

P.S.: Normally this story goes the other way round, like: "After n years of bothering myself with M$-Dog i decided to switch to macOS. The one and only working unixoid desktop solution and a developers paradise". I don't know what happened. Your mileage may vary. «The Crux of the Biscuit is the Apostrophe» perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Drink a little drink and smoke a little smoke and rethink your decision

The first two clauses make good sense, but the third is insane.

Cheers,
Rob

Please explain why. Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help Re: Perl on Windows 10 by kcott (Bishop) on Aug 13, 2019 at 06:51 UTC Thanks to everyone for all the advice and suggestions. I would have preferred to have written this some weeks ago; however, I've had some problems: the new hardware had various issues and needed returning to be fixed; the old hardware came out in sympathy and stopped working; and then a week in bed with a virus. All in all, July was not my favourite month this year. Anyway, everything's more or less back to normal now. Here's what I ended up doing: • Firstly, after much deliberation, I went with a Cygwin solution to provide the UNIX-like environment I wanted. This is working well. • Cygwin came with this perl: $ /usr/bin/perl -v

This is perl 5, version 26, subversion 3 (v5.26.3) built for x86_64-cy
(with 7 registered patches, see perl -V for more detail)
[download]
• I installed Perlbrew using pretty much the default instructions on that page:
\curl -L https://install.perlbrew.pl | bash
perlbrew install perl-5.30.0
perlbrew switch perl-5.30.0
[download]
All of this ran without any problems at all. Now I have:
$perl -v This is perl 5, version 30, subversion 0 (v5.30.0) built for cygwin-th +read-multi [download] There were a lot of comments on various forums about how Perl could not be run successfully on Windows without a substantial amount of jumping through hoops. This may be true for earlier versions of Cygwin (I have 3.0.7), Windows, or Perl: I encountered no such problems. • I then used the cpan utility to install my usual collection of modules. Probably 95% just installed without any problems; there were no insurmountable problems with the rest (which mostly just needed a different dependency install order from what I had been using on the Mac). So, overall I'm very pleased with this. I have everything I need for both personal and$work Perl coding.

Thanks again to all who helped.

— Ken

Create A New User
Node Status?
node history
Node Type: perlquestion [id://11101639]
Approved by marto
Front-paged by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2020-12-05 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
How often do you use taint mode?

Results (63 votes). Check out past polls.

Notices?