1

I've got some perl source code here, how do I build it on Windows, to get a windows binary that I can work with?

Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
  • possible duplicate of [How can I compile my Perl script so it can be executed on systems without perl installed?](http://stackoverflow.com/questions/1237286/how-can-i-compile-my-perl-script-so-it-can-be-executed-on-systems-without-perl-in) – Paul Tomblin Nov 23 '10 at 12:49
  • Also http://stackoverflow.com/questions/77278/how-can-i-package-my-perl-script-to-run-on-a-machine-without-perl – Paul Tomblin Nov 23 '10 at 12:50
  • 3
    May I remind you of [Dr Strangedupe?](http://blog.stackoverflow.com/2010/11/dr-strangedupe-or-how-i-learned-to-stop-worrying-and-love-duplication/) – Ivo Flipse Nov 23 '10 at 12:56

4 Answers4

4

I've found Cava Packager to be just what I needed.

alt text
(source: cavapackager.com)

How to compile Perl scripts into EXEs

Download ActivePerl 5.10 for Windows.
Install it.
Restart your PC.

Download Cava Packager
Install it.
Open it.

Make a new project choosing a blank folder.

Scripts > Add..
Choose your .PL script file

Perl library > [...]
Choose "C:\Perl\bin\perl510.dll"
Add
Choose "C:\Perl\lib\"
Save

Build

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
4

Usage of external tools normally comes with compatibility issues, random errors etc. You are better off using the inbuilt perl 'pp' tool. Install PAR::Packer (which includes the pp tool) module and then read the manual for it... It allows you to pack your perl scripts to executables, and has options as what modules and dependencies to include, I've used it on winXP and win7 and never had an issue with any executabe produced.

pp manual

cyber-guard
  • 1,776
  • 14
  • 30
  • How do I install "pp" or "PAR::Packer" itself? I've got ActivePerl on Windows 7. Now what? – Robin Rodricks Nov 23 '10 at 14:15
  • It should be available via PPM (package perl manager, just run 'ppm' command) and then use the search function, or just run 'ppm install PAR::Packer'. I am not sure though the module is in the main cpan repository, so you might actually have to download it from cpan and install manually... – cyber-guard Nov 23 '10 at 17:27
0

You could use the Perl Development Kit from ActiveState to "compile" your script to a .exe file. I used it to create binaries of MRTG and a couple tools more to be deployed on windows servers running as a service. There used to be another product (from IndigoStar or something) called perl2exe I think to get the same result.

Camilo Estevez
  • 637
  • 1
  • 8
  • 16
0

Just a note that Cava Packager also supports creating executables from Perl code on Linux and Mac OS X in addition to the original Windows version.

Note: As indicated by my name, I am affiliated with Cava Packager.

cavapack
  • 41
  • 1
  • 2
  • FYI, you can suggest edits to existing answers to keep them current and correct, I think that would be more appropriate here. If you have not seen it please review [the FAQ "May I promote products or websites I am affiliated with here?"](http://stackoverflow.com/faq#promotion). – Andy May 21 '11 at 18:45
  • Never mind, apparently this is not an appropriate edit to suggest. http://stackoverflow.com/suggested-edits/48875 – Andy May 21 '11 at 19:38