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

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:

  • perl2exe of IndigoStar It is commercial. I never tried. Its web site says it can cross compile Win32, Linux, and Solaris.
  • 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.
  • 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?


    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.


    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.


    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.

    链接地址: http://www.djcxy.com/p/54574.html

    上一篇: 如何管理你的Perl应用程序的开发,构建和部署?

    下一篇: 如何将我的Perl脚本打包到没有Perl的机器上运行?