» about » content » twitter » github »

How to make a Perl Executable

Prelude

There are times when I'd like to create a stand-alone executable (a program with no Perl interpreter) but use my Perl skills (rather than re-write a script in Delphi or C).

I'd mainly need to do this if I want to quickly distribute a script to people who don't have the skill or inclination to install the Perl interpreter on their system.

I found several methods of doing this, but here's the one I like the most...

pp - PAR Packager

There is a utility called pp which utilizes the PAR Packager libraries.

On Windows, you can install it using Activestate's ppm package management utility, or cpan under any of the *nixes to get all the required libraries, and then get the actual pp utility from Here.

pp comes with install instructions which I won't duplicate here as they may change, but it was simple and efficient to install under Windows.

Compiling

Here's a very simple Perl script (called hello.pl:

#!/usr/bin/perl
print "Hello World!\n";
    

Then you compile it:

pp -o hello.exe hello.pl
    

Now you should have an Perl executable called hello.exe which you can run on any Windows system (including one without a Perl interpreter).

More Questions?

On PAR? : Try here.

© Roqet 2018 :: 2018-05-11 17:07:10