Home > Perl > Perl on Windows > Compiling Perl Scripts using Perl2Exe
Compiling Perl Scripts using Perl2Exe
Written by Philip L Yuson   
Who should read this
Those who want to compile their Perl scripts to executable files.

As it is, Perl scripts are portable across several platforms. Portability is defined as a write once execute anywhere process. You write a script on one operating system (ex. Windows) and it will work in another operating system (ex. Linux).

However, this portability comes with a price - you need to have Perl installed in the system where the script will be run. Since Perl is a scripting language, you will need access to the source code. There may be instances when you do not want others to have access to the source code (security, source control, etc). Or maybe you want to restrict the use of the Perl compiler/interpreter. If you have this need, then this tool is very handy.

Perl2Exe converts your Perl script into an executable file. It compiles you script and produces an executable form. You can then execute this file like any other executable file. You do not even need to install Perl on the machine where the program will run.

If your concern is source control, then Perl2Exe certainly prevents others from looking at your source. Likewise, if you want to restrict the use of Perl in your system, then compiling them would be a good way to do this.

Where Can I Get It

Perl2Exe is distributed by IndigoStar Software. You can download the evaluation copy or purchase the production copy from them. If you get the evaluation copy, you can still compile your Perl scripts except that you will be pestered with a marketing message at the end of execution.

Well, you got their software for free - so at least allow them to remind you of that. If you do not want the marketing message to appear at the end of program execution, then you can buy a production copy.

They have a version for many platforms, Windows, Unix and of course Linux.

Anything Else I Need to Know
You can compile your script into one exec file or into one exec file and several other .dll files. To produce only one exec file, just type this on your DOS window:

perl2exe scriptname.pl

The output file will be an executable file called scriptname.exe.

To produce one smaller exec file plus several .dll files, you need to add the -tiny option:

perl2exe -tiny scriptname.pl

The .dll files are actually the compiled versions of the modules you used. So if you compile several scripts that use the same modules, it would be more efficient to compile using the -tiny model.

To know more about Perl2Exe, go to the IndigoStar website.

Copyright: © 2018 Philip Yuson