Rich Waters

Ext, Javascript, Notes/Domino, Ext.nd, Ruby on Rails

I had the need to compile a perl script into a Windows executable and turned to the trusty PAR package. There are quite a few applications and ways to go about this, but PAR has by far produced the best results in my experiences. The setup is a Windows XP box running Active Perl with the following modules installed

Parse::Binary
Win32::Exe
Module::ScanDeps
PAR::Dist
PAR



All modules are available via PPM or better yet CPAN (though on windows this would require nmake). Once you have all the proper modules compiling the script is a snap. Most information I’ve found out there is outdated and shows all the parameters for the command line version, I find it much easier to just use ‘tkpp’ which is the GUI version (this requires the Tk perl library).

Tkpp brings up a simple window with a couple options to pick. Select the perl script in question, then designate an exe filename for it to generate. I would recommend selecting ‘execute + static’ which will help it detect the libraries needed at run time and automatically include them. You can add additional libraries manually, but it’s normally not necessary. If you want to specifiy an icon file for the generated executable you can. If the app is GUI only you can check the box to make sure a separate console window isn’t launched. Then just click on build and wait a little bit. Once complete you get a stand alone exe file that can be ported to other windows machines without the need to install perl or any specific modules.

A couple of things to note. There is no real protection of the code, the generated exe will actually extract all the perl files into a temporary folder and run them through an interpreter. The first time that the exe is run it will delay about 30 seconds or so as it extracts all the files. Future runs will go much more quickly.

Share and Enjoy:
  • Digg
  • Facebook
  • Google Bookmarks
  • Posterous
  • RSS
  • Twitter
U Comment, I Follow - Heavily moderated, SPAM will be dealt with.

Leave a Reply