如何检测程序是否正在 PAR 存档中运行?

发布于 2024-08-11 11:28:11 字数 283 浏览 2 评论 0原文

我正在开发一个大型 Perl 应用程序,它与 PAR 捆绑在一起,以及一堆支持文件。

当应用程序在 PAR 中运行时,我可以使用 PAR::read_file 来获取存档内的这些不同文件。然而,在开发过程中,我不想每次调整一些代码时都必须重新 PAR 整个应用程序。

有没有办法可以判断脚本是否在运行时在 PAR 中运行,以便我可以选择从 PAR 存档或常规文件系统加载文件?

I'm working on a large Perl application which gets bundled with PAR, along with a bunch of support files.

When the app is running within PAR, I can use PAR::read_file to get at these various files inside the archive. However, while I'm developing, I don't want to have to re-PAR the whole application every time I tweak some code.

Is there a way that I can tell if the script is running within PAR or not at runtime, so I can choose to load the file from the PAR archive or the regular filesystem?

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

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

发布评论

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

评论(1

沐歌 2024-08-18 11:28:11

PAR::Environment 可能可以提供一些线索:

PAR 在可执行文件或 PAR 存档的构建过程以及它们的使用过程中使用各种环境变量。

...

PAR_0

如果正在运行的程序是从 PAR 存档或 pp 生成的可执行文件中运行的,则此变量包含提取的程序的名称(即 .pl 文件)。

PAR::Environment can probably offer some clues:

PAR uses various environment variables both during the building process of executables or PAR archives and the use of them.

...

PAR_0

If the running program is run from within a PAR archive or pp-produced executable, this variable contains the name of the extracted program (i.e. .pl file).

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