简体   繁体   English

如何提供(分发)Perl应用程序?

[英]How do I deliver (distribute) a Perl application?

I wrote a program in Perl, and now I want to send it to buddy. 我在Perl中编写了一个程序,现在我想把它发送给好友。 I don't want him having any kind of bother with launching it. 我不希望他有任何打扰它的麻烦。

How do I make some package which he can just click and have all things ready to launch? 我如何制作一些他可以点击的包装并准备好所有的东西?

PS. PS。 I can ask him to download ActivePerl and install it beforehand. 我可以请他下载ActivePerl并事先安装它。

PPS. PPS。 I don't need to hide .pl sources from him. 我不需要隐藏.pl来源。 I need though automatic download and install of all required CPAN modules. 我需要自动下载和安装所有必需的CPAN模块。

Also, what if in future I will need to scale it for production delivery? 另外,如果将来我需要将其扩展用于生产交付呢? Meaning, it will be not a buddy on the receiving side, but Mr. Client? 这意味着,它不是接收方的伙伴,而是客户先生?

I have used pp with great success. 我使用pp非常成功。 It can package a Perl interpreter and used modules all together into an executable file. 它可以将Perl解释器打包并将所有模块一起用于可执行文件。

Then again there is always B::C which provides a perlcc utility, but I haven't had as much luck with that. 然后总是有B::C提供perlcc实用程序,但我没有那么多运气。

为了便于分发到Windows客户端,它很难击败PerlAppPar :: Packer (又名pp)或Cava Packager

Although I like Joel's suggestion best I'd want to point out another solution for you. 虽然我最喜欢乔尔的建议,但我想为你指出另一种解决方案。 As it seems you're targeting Windows you could also use the portable version of Strawberry Perl . 由于您似乎在瞄准Windows,因此您也可以使用Strawberry Perl的便携版本。 Install the modules you need, add your script/application to it, setup a simple batch script to launch it with the portable environment and you're set. 安装所需的模块,添加脚本/应用程序,设置一个简单的批处理脚本,以便在便携式环境中启动它,然后进行设置。

The biggest downside compared to the pp (PAR::Packer) solution is that the size of your application will be rather big as pp only includes that what is necessary. 与pp(PAR :: Packer)解决方案相比,最大的缺点是应用程序的大小将相当大,因为pp仅包含必要的内容。

You might be looking for IndigoStar's perl2exe : 您可能正在寻找IndigoStar的perl2exe

Perl2Exe is a command line program for converting Perl scripts to executable files. Perl2Exe是一个命令行程序,用于将Perl脚本转换为可执行文件。 This allows you to create stand alone programs in Perl that do not require the Perl interpreter. 这允许您在Perl中创建不需要Perl解释器的独立程序。 You can ship the executable files without having to ship your Perl source code. 您可以发送可执行文件,而无需发送Perl源代码。 Perl2Exe can generate executables for Windows and Unix target hosts. Perl2Exe可以为Windows和Unix目标主机生成可执行文件。

Of course, the easiest way would be if your clients could run perl. 当然,最简单的方法是你的客户可以运行perl。

Yoy may wish to try Cava Packager . Yoy不妨试试Cava Packager It can produce executables from Perl code on Windows, Linux and Mac OS X. It takes an alternative approach to PerlApp, pp and perl2exe. 它可以从Windows,Linux和Mac OS X上的Perl代码生成可执行文件。它采用了PerlApp,pp和perl2exe的替代方法。 You should probably try them all and decide which you like best. 你应该尝试一下,然后决定你最喜欢哪一个。

Note: As indicated by my name, I am affiliated with Cava Packager. 注意:正如我的名字所示,我与Cava Packager有联系。

Par::Packer will do the job for you, without any fuss and is completely free. Par :: Packer将为您完成工作,不用大惊小怪,完全免费。 As long as you have installed the correct dependencies, you simply (on a windows machine) open a command prompt, CD into the directory where your perl source (eg 'samplefile.pl') resides and type: pp -o sampleprogram.exe samplefile.pl. 只要您安装了正确的依赖项,您只需(在Windows机器上)打开命令提示符,将CD放入perl源(例如'samplefile.pl')所在的目录中,然后键入:pp -o sampleprogram.exe samplefile特等。 After a minute or so, 'samplefile.exe' is compiled, and you can send it to your friend to run 大约一分钟后,'samplefile.exe'被编译,您可以将它发送给您的朋友来运行

Perl2Exe is a proprietary solution, and although it is good, is not free Perl2Exe是一种专有解决方案,虽然很好,但并不是免费的

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM