perl解释器的状态码是什么意思?
我正在尝试使用 Java 的 Runtime.exec() 执行 Perl 解释器的副本。但是,它返回错误代码 9
。运行该文件几次后,perl 解释器神秘地开始返回代码 253,而我的命令根本没有任何变化。
代码 253
/ 代码 9
是什么意思?在 Google 上搜索 perl
解释器的退出代码没有找到任何结果。在哪里可以找到 Perl 解释器的退出代码列表?
I'm trying to execute a copy of the Perl interpreter using Java's Runtime.exec(). However, it returned error code 9
. After running the file a few times, the perl
interpreter mysteriously started to return code 253 with no changes in my command at all.
What does code 253
/ code 9
mean? A Google search for perl
interpreter's exit codes turned up nothing. Where can I find a list of exit codes for the Perl interpreter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
请参阅 perldoc perlrun:
因此,您正在运行的程序必须以某种方式通过 die, < a href="http://perldoc.perl.org/functions/exit.html" rel="nofollow noreferrer">exit 或同等内容。
See perldoc perlrun:
Thus, the program you are running must be somehow specifying those exit values via die, exit or equivalent.
如果脚本不运行,perl 解释器实际上确实返回它自己的退出代码。大多数语法错误会导致退出代码 9:
未知函数/不允许的裸字:
$? = 9
除以零:
$? = 9
语法错误:
$? = 9
使用 die:
$? = 9
未知模块是我发现 perl 以不同方式退出的唯一一种情况:
$? = 2
顺便说一句,我仍在寻找 Perl 解释器退出代码的完整列表。除了 Perl 解释器源之外,有人知道去哪里看吗?
The perl interpreter actually does return exit codes of its own if the script doesn't run. Most syntax errors lead to exit code 9:
Unknown function / disallowed bareword:
$? = 9
division by zero:
$? = 9
syntax error:
$? = 9
using die:
$? = 9
an unknown module was the only one situation I found perl to exit differently:
$? = 2
BTW I'm still searching for a comprehensive list of the perl interpreter's exit codes myself. Anyone got an idea where to look, aside from the perl interpreters sources?
在正常情况下,
perl
将返回它运行的程序返回的任何内容。因此,在不知道它正在运行的程序的情况下,您无法概括返回值的含义。In normal circumstances,
perl
will return whatever the program it runs returns. Hence you can not generalize the meaning of the return value without knowing the program it's running.Perl 本身没有任何定义的退出代码;除非 perl 解释器以非常可怕的方式崩溃,否则退出代码由
perl
正在运行的程序决定,而不是由perl
本身决定。Perl itself doesn't have any defined exit codes; unless the perl interpreter crashes in a really horrific way, the exit code is determined by the program that
perl
is running, not byperl
itself.由于运行几次后错误代码发生了变化;如果您将
Java
应用程序作为持续运行的 Web 应用程序运行,请检查是否存在某种内存泄漏。您可以通过使用 perl 解释器的
-Tw
选项运行您的perl
脚本来测试其是否存在各种问题,有关启用的污染模式和警告,请参阅 perlrun 有关这些的更多信息。Since the error code changed after some runs; if you are running a
Java
app as a continuously running webapp, check if it can be some kind of memory leak.You can test your
perl
script from various problems by running it with the perl interpreter's-Tw
options, for tainted modes and warnings enabled, see perlrun for more info about these.