How to Pack a Perl Script into a Single Executable

BoxedApp Packer bundles a Perl script into one self-contained EXE. Runtime files, modules, and your assets are embedded and served from a virtual file system in memory - no installation and no temp files on disk.

The Task

On Windows, distributing a Perl script usually means asking users to install a Perl runtime. With BoxedApp Packer you can avoid that by shipping a single EXE that contains the runtime, modules, and your script.

The sample prints lines from an external text file and will embed that file too.

Prepare the Package

Download a Perl runtime (for example ActivePerl or Strawberry Perl) and BoxedApp Packer. Launch Packer and set perl.exe as the input executable, then choose any output EXE name.

To run the script normally you would pass the script path to perl.exe:

perl.exe hello.pl

In Packer, enable Override command line and set:

<BoxedAppVar:OldCmdLine> "<ExeDir>\hello.pl"

This makes the packed EXE run as if hello.pl was passed to perl.exe. Now add required runtime files and modules.

  • In Application Directory, add perl.exe (from the Perl installation bin directory).
  • Add perl520.dll or the corresponding Perl DLL required by your runtime (from the same bin directory).
  • Add core modules the script uses, for example strict.pm and warnings.pm (from Perl lib directory).
  • Add your script hello.pl and any data files, for example hello.txt.
Check the option "Run packed exe in virtual environment". This ensures all file and registry I/O is served by the virtual layer and nothing is written to disk.

Build and run. It prints the expected text.

Screenshots

1. Select perl.exe
1. Select perl.exe
2. Set output name
2. Set output name
3. Override command line
3. Override command line
4. Run in virtual environment
4. Run in virtual environment
5. Add files
5. Add files
6. Build and run
6. Build and run

Benefits

  • Single EXE distribution on Windows - no Perl installation required.
  • Files are virtualized and not written to disk - protect sources and assets.
  • Works from USB or network share, no admin rights required.
  • Supports icons, splash screens, and custom launch parameters.