Which Perl modules does git for Windows come with?

3.3k views Asked by At

I want to write a Perl script that will work on Windows, which doesn't have Perl installed by default. The users are guaranteed to have git installed, so I am considering using that one.

But I don't know which modules are guaranteed to be present. Is this documented somewhere? If not, can I find out some other way?

4

There are 4 answers

13
ikegami On BEST ANSWER

Use App::FatPacker to inline (non-XS) modules into your script.

3
Borodin On

For a Windows machine you need to install either Strawberry Perl or possibly ActivePerl. You certainly shouldn't be relying on whatever happens to come with another distribution

Perl is developed very carefully so that it will mostly accept very old Perl code without change. But if your Perl has to perform identically on someone else's system then you may need to be more careful

What matters most is whether you need a 32-bit or a 64-bit version of Perl, and what version of the Perl compiler you need. You shouldn't concern yourself with what modules are available, as it is simple to add any Windows-compatible modules to the base installation

If you need more help than this then we need more information, which you should edit into your question

8
Mark VY On

brute force solution: install git on a windows machine that doesn't have it and see what modules show up. ick!

5
dasgar On

My approach is a combination of some of the other suggestions along with a new wrinkle.

I'd start with using a portable edition of Strawberry Perl. That's an easy way to get a good clean Perl installation without interfering with your git installation's Perl. (Alternatively, you could look into using berrybrew, which emulates perlbrew for the Windows environment by leveraging portable editions of Strawberry Perl.)

After you get your portable Strawberry Perl environment setup with the modules that you need for your script, use the cpan or cpanm client (included in Strawberry Perl) to install PAR::Packer, which will provide you with the pp utility. Using the pp utility, you can bundle your Perl script into a standalone executable - which in turn can be run on another Windows system that does not have Perl installed. When using the pp utility, be sure to use the -c and/or -x options to ensure that pp will pickup all of the run time dependencies to bundle those in as well.