How to Convert Perl Script to EXE
The Perl programming language is an interpreted language. That means that the source code is evaluated when the program is run by a Perl interpreter rather than translated into machine code (EXE files) to be run by the operating system later. This allows Perl programs to be run on any operating system that has a Perl interpreter installed with only minimum modification, but it also can present problems when the time comes to distribute Perl software to users who do not have and do not want to install a Perl interpreter on their own systems. To solve this problem, the Perl CPAN library includes a free utility called PAR Packager (pp) that can easily create both Linux and Windows native executables that contain their own embedded Perl interpreter.
Instructions
-
-
1
Open a terminal/command prompt. On Windows, do this by clicking "Start," "Run" and typing "cmd." On Mac OS X, click the Spotlight button (which looks like a magnifying glass) and type "Terminal." On Linux, the procedure will vary depending on how your operating system has been configured. If you are unsure how to open a terminal, consult the documentation for your version of Linux.
-
2
Install pp from the CPAN library by typing the following command:
cpan pp
In Linux or Mac OS X, you should instead type:
sudo cpan pp
-
-
3
Type the following to convert your Perl script to a Windows EXE:
pp -o result source.pl
This would convert the script "source.pl" to the executable file "result" or "result.exe," depending on whether the command is run in Linux, Mac OS X or Windows.
-
1
Tips & Warnings
Add the "-gui" flag to the pp command line under Windows to create a program that does not open a terminal/command prompt upon starting.
References
- Photo Credit Dick Luria/Valueline/Getty Images