使用 pp 编译 perl 源

发布于 2024-12-25 15:12:22 字数 1535 浏览 4 评论 0原文

我有一个功能完美的 perl 脚本(在 debian linux 上的 bash 终端中编写),在使用 pp 编译时无法执行(在 Linux 或 Windows 上)。这可能与构建中未满足的依赖项有关,但我确实相信以下命令将所有依赖项打包到可执行文件中:

    pp -o out.exe in.pl

当我说它运行良好时,我的意思是,如果我调用 ,则将生成预期的输出,没有错误。 /in.pl 来自 bash 终端。

我想创建一个可以在 Linux 或 Windows 上运行的可执行文件(如果每个操作系统都需要单独的文件,那就这样吧)。

这些是源代码中包含的包:

use strict;
use warnings;
use charnames ":short";
binmode(STDOUT,":utf8");
use Term::ANSIColor;
use Number::Format;
use Finance::Quote;
use Finance::QuoteHist;
use Date::Manip;     # this may be included by Finance::QuoteHist

如果有帮助,这是我收到的错误消息(警告,它很长):

ERROR: [config_var] invalid zone in SetDate
ERROR: [config_var] invalid zone in SetDate
Could not load either Text::CSV_XS or Text::CSV_PP : Can't locate Text/CSV_PP.pm in @INC (@INC contains: CODE(0x1422320) /tmp/par-username/cache-addd1cc2ee9285c150584c1853c2b67c0c482e7e/inc/lib /tmp/par-username/cache-addd1cc2ee9285c150584c1853c2b67c0c482e7e/inc CODE(0x11675b0) CODE(0x116ebc8)) at (eval 30) line 2.
BEGIN failed--compilation aborted at (eval 30) line 2.
at Finance/QuoteHist.pm line 13
Compilation failed in require at Finance/QuoteHist.pm line 13.
BEGIN failed--compilation aborted at Finance/QuoteHist.pm line 13.
Compilation failed in require at script/in.pl line 10.
BEGIN failed--compilation aborted at script/in.pl line 10.

从运行时错误来看,问题可能与未满足的递归依赖项有关(例如,依赖项在 Finance::QuoteHist 内)。也许这些递归依赖关系应该明确包含在内?这是我第一次尝试将 perl 编译为可执行文件,因此感谢您提供的任何指导。

I have a perfectly functioning perl script (written in bash terminal on debian linux) that fails to execute (on either linux or windows) when compiled using pp. This may relate to unmet dependencies in the build, but I do believe the following command packages all dependencies into the executable:

    pp -o out.exe in.pl

When I say it is perfectly functioning, I mean that the intended output is generated with no errors if I invoke ./in.pl from a bash terminal.

I would like to create an executable that will run on either linux or windows (if a separate file is required for each OS, so be it).

These are the packages that are included in the source:

use strict;
use warnings;
use charnames ":short";
binmode(STDOUT,":utf8");
use Term::ANSIColor;
use Number::Format;
use Finance::Quote;
use Finance::QuoteHist;
use Date::Manip;     # this may be included by Finance::QuoteHist

If it helps, here is the error message I get (warning, it's long):

ERROR: [config_var] invalid zone in SetDate
ERROR: [config_var] invalid zone in SetDate
Could not load either Text::CSV_XS or Text::CSV_PP : Can't locate Text/CSV_PP.pm in @INC (@INC contains: CODE(0x1422320) /tmp/par-username/cache-addd1cc2ee9285c150584c1853c2b67c0c482e7e/inc/lib /tmp/par-username/cache-addd1cc2ee9285c150584c1853c2b67c0c482e7e/inc CODE(0x11675b0) CODE(0x116ebc8)) at (eval 30) line 2.
BEGIN failed--compilation aborted at (eval 30) line 2.
at Finance/QuoteHist.pm line 13
Compilation failed in require at Finance/QuoteHist.pm line 13.
BEGIN failed--compilation aborted at Finance/QuoteHist.pm line 13.
Compilation failed in require at script/in.pl line 10.
BEGIN failed--compilation aborted at script/in.pl line 10.

Judging from the run-time errors, the problem may relate to unmet recursive dependencies (for instance, dependencies within Finance::QuoteHist). Perhaps these recursive dependencies should be included explicitly? This is my first time attempting to compile perl into an executable, so thanks for any guidance you can provide.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

您可以尝试对 pp 使用 -x 标志,如

You might try to use the -x flag to pp as seen in the docs. It runs the script and checks for dependencies as it goes, which is more accurate than simply scanning for dependencies. I have needed this when using Tk and it worked wonders.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文