如何打包我的Perl脚本以在没有Perl的机器上运行?

时间:2023-01-18 01:08:56

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.

人们也常常问“如何编译Perl?”而他们真正想要的是创建一个可以在机器上运行的可执行文件,即使他们没有安装Perl。

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. IndigoStar的perl2exe它是商业的。我从未尝试过。它的网站说它可以交叉编译Win32,Linux和Solaris。
  3. 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.
  4. 来自ActiveState的Perl Dev Kit。它是商业的。几年前我在Windows上使用它,它可以很好地满足我的需求。根据其网站,它适用于Windows,Mac OS X,Linux,Solaris,AIX和HP-UX。
  5. 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.
  6. PAR或者说PAR :: Packer是免费和开源的。根据测试报告,它可以在Windows,Mac OS X,Linux,NetBSD和Solaris上运行,但理论上它也可以在其他UNIX系统上运行。最近我开始在Linux上使用PAR进行打包,并且也将在Windows上使用它。

Other recommended solutions?

其他推荐解决方案

4 个解决方案

#1


12  

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.

除了问题中列出的三个工具之外,还有另一个名为Cava Packager的人,由Mark Dootson编写,他过去也曾为PAR做过贡献。它只能在Windows下运行,有一个很好的Wx GUI,并且与典型的三个竞争者的工作方式不同,因为它在源/ lib目录中组装所有Perl依赖项,而不是创建包含所有内容的单个归档。有一个免费版本,但它不是开源的。我没有用过这个,除了测试。

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.

至于PAR,它确实是一个工具包。它附带了一个打包工具,可以执行独立可执行文件的依赖项扫描和组装,但它也可以用来生成和使用所谓的.par文件,类似于Java的JAR。它还带有客户端和服务器,用于通过网络自动加载丢失的软件包等。我在YAPC :: EU 2008上的PAR演讲的幻灯片详细介绍了这一点。还有一个活跃的邮件列表:parl at perl dot org。

#2


5  

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.

这个问题首次被问到已经有一段时间了,但是Cava Packager目前可以为Windows,Linux和Mac OS X生成可执行程序包。它不再仅仅是Windows。

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

注意:正如我的名字所示,我与Cava Packager有联系。

#3


1  

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.

我是一个Perl新手,我刚刚下载了Cava Packager,这是我发现的唯一一个。我在Windows XP上尝试过ActiveState 5.10.1005和带有PAR-Packager的Strawberry Perl。 pp只是在流中挂起而没有创建可执行文件。

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

到目前为止,Cava提供了在Windows上创建exe的唯一解决方案。 THKS。

#4


-3  

You could use the perlcc tool that's shipped with most distributions of Perl. I've also found both perl2exe and Active State's Perl Dev kit useful for shipping Perl applications.

您可以使用大多数Perl发行版附带的perlcc工具。我还发现perl2exe和Active State的Perl开发工具包对于运送Perl应用程序非常有用。

#1


12  

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.

除了问题中列出的三个工具之外,还有另一个名为Cava Packager的人,由Mark Dootson编写,他过去也曾为PAR做过贡献。它只能在Windows下运行,有一个很好的Wx GUI,并且与典型的三个竞争者的工作方式不同,因为它在源/ lib目录中组装所有Perl依赖项,而不是创建包含所有内容的单个归档。有一个免费版本,但它不是开源的。我没有用过这个,除了测试。

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.

至于PAR,它确实是一个工具包。它附带了一个打包工具,可以执行独立可执行文件的依赖项扫描和组装,但它也可以用来生成和使用所谓的.par文件,类似于Java的JAR。它还带有客户端和服务器,用于通过网络自动加载丢失的软件包等。我在YAPC :: EU 2008上的PAR演讲的幻灯片详细介绍了这一点。还有一个活跃的邮件列表:parl at perl dot org。

#2


5  

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.

这个问题首次被问到已经有一段时间了,但是Cava Packager目前可以为Windows,Linux和Mac OS X生成可执行程序包。它不再仅仅是Windows。

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

注意:正如我的名字所示,我与Cava Packager有联系。

#3


1  

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.

我是一个Perl新手,我刚刚下载了Cava Packager,这是我发现的唯一一个。我在Windows XP上尝试过ActiveState 5.10.1005和带有PAR-Packager的Strawberry Perl。 pp只是在流中挂起而没有创建可执行文件。

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

到目前为止,Cava提供了在Windows上创建exe的唯一解决方案。 THKS。

#4


-3  

You could use the perlcc tool that's shipped with most distributions of Perl. I've also found both perl2exe and Active State's Perl Dev kit useful for shipping Perl applications.

您可以使用大多数Perl发行版附带的perlcc工具。我还发现perl2exe和Active State的Perl开发工具包对于运送Perl应用程序非常有用。