How can I package my Perl script to run on a machine without Perl?

11,557

Solution 1

In addition to the three tools listed in the question, there's another one called Cava Packager written by Mark Dootson, who has also contributed to PAR in the past. It only runs under Windows, has a nice Wx GUI and works differently from the typical three contenders in that it assembles all Perl dependencies in a source / lib directory instead of creating a single archive containing everything. There's a free version, but it's not Open Source. I haven't used this except for testing.

As for PAR, it's really a toolkit. It comes with a packaging tool which does the dependency scanning and assembly of stand-alone executables, but it can also be used to generate and use so-called .par files, in analogy to Java's JARs. It also comes with client and server for automatically loading missing packages over the network, etc. The slides of my PAR talk at YAPC::EU 2008 go into more details on this. There's also an active mailing list: par at perl dot org.

Solution 2

It is some time since this question was first asked, but Cava Packager can currently produce executable packages for Windows, Linux and Mac OS X. It is no longer Windows only.

Note: As indicated by my name, I am affiliated with Cava Packager.

Solution 3

I'm a Perl newbie and I just downloaded Cava Packager and that's the only one I found working. I've tried ActiveState 5.10.1005 and Strawberry Perl with PAR-Packager on Windows XP. pp just hangs in mid-stream and no executables created.

Cava provides the only solution to creating exe on Windows so far. Thks.

Share:
11,557
szabgab
Author by

szabgab

I help improving engineering practices by providing training, mentoring, coaching. Implementing techniques and technologies. Introducing Unit, Integration, and Acceptance testing Continuous Integration (CI) Continuous Deployment (CD) Software and System Configuration Management Version Control Systems (e.g. Subversion, Git) Build system Perl, Python, JavaScript Linux Basics for Power Users Database integration (SQL, NoSQL) Web Application Development Test Automation and Quality Assurance (QA) Adding telemetry to products and services Chief editor and publisher of the Perl Weekly newsletter. Author of the Perl Maven site with the Perl tutorial on it. Also the Code Maven site.

Updated on June 13, 2022

Comments

  • szabgab
    szabgab almost 2 years

    People also often ask "How can I compile Perl?" while what they really want is to create an executable that can run on machines even if they don't have Perl installed.

    There are several solutions, I know of:

    1. perl2exe of IndigoStar It is commercial. I never tried. Its web site says it can cross compile Win32, Linux, and Solaris.
    2. Perl Dev Kit from ActiveState. It is commercial. I used it several years ago on Windows and it worked well for my needs. According to its web site it works on Windows, Mac OS X, Linux, Solaris, AIX and HP-UX.
    3. PAR or rather PAR::Packer that is free and open source. Based on the test reports it works on the Windows, Mac OS X, Linux, NetBSD and Solaris but theoretically it should work on other UNIX systems as well. Recently I have started to use PAR for packaging on Linux and will use it on Windows as well.

    Other recommended solutions?

  • asksol
    asksol over 15 years
    perlcc doesn't really work, and it has been like that for a long time. PAR is the way to go.
  • szabgab
    szabgab over 15 years
    perlcc mostly does not work (see perldoc perlcc) and has been removed from perl 5.10
  • Andy
    Andy almost 13 years
    According to cavapack's answer and the Cava website, it now runs on Linux and OS X too.
  • Balakumar
    Balakumar over 10 years
    Could you please tell me how to use cava packager
  • Nate Glenn
    Nate Glenn over 10 years
    Strawberry with pp worked for me (4 years after your answer).