Here I'll describe how to compile/package a 32-bit portable, standalone Windows executable from Perl code using PAR with ActiveState or Strawberry Perl, on Windows 2000 and later Windows versions. Possibly other versions too; I haven't tested them. Read more about Perl on Windows here.
If you're using Strawberry Perl, just use ''cpan -i'' to install PAR as well, as described below.
From PowerShell or cmd.exe (I recommend PowerShell), issue the following commands, in this order - or at least make sure you run the last CPAN command '''after''' MingW is successfully installed, because you need dmake for compiling:
> ppm install PAR > ppm install MingW
Then issue the following command to install PAR::Packer from CPAN (this took like 15-20 minutes for me, on a Core 2 Quad 2.8 GHz, maxing one core):
> cpan -i PAR::Packer
The version of PAR::Packer I currently have in the test environment is '''1.010''' and the PAR version is '''1.002''' as shown below. By the way, if you're using cmd.exe instead of PowerShell, these one-liners will fail. See this article about Perl from PowerShell for more information about quoting differences; basically, just use double quotes instead - in this case.
PS C:\> perl -MPAR::Packer -le 'print $PAR::Packer::VERSION' Set up gcc environment - 3.4.5 (mingw-vista special r3) 1.010 PS C:\> perl -MPAR -le 'print $PAR::VERSION' 1.002
PS E:\temp> type .\perlcode.pl use warnings; use strict; print "This is the Perl code!\n";PS E:\temp> pp -o perlcode.exe .\perlcode.pl
Set up gcc environment - 3.4.5 (mingw-vista special r3) Set up gcc environment - 3.4.5 (mingw-vista special r3) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Set up gcc environment - 3.4.5 (mingw-vista special r3) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. PS E:\temp> .\perlcode.exe This is the Perl code!
As you can see, the command I used is:
> pp -o perlcode.exe .\perlcode.pl
> pp -o something.exe -M Some::Module -M Some::Other::Module -M And::So::On perlscript.plPerl Windows All Categories
Minimum cookies is the standard setting. This website uses Google Analytics and Google Ads, and these products may set cookies. By continuing to use this website, you accept this.