perl cgi 无法工作

发布于 2024-12-20 12:57:36 字数 153 浏览 2 评论 0原文

我有 perl 脚本,它从 cgi 页面生成,并成为一个独立运行的守护进程。如果有一个模具从它正在使用的任何模块调用,则该脚本将被调用,尽管它已在 eval 块中处理。不过,当我从命令提示符运行脚本时,一切都很好并且错误正在得到处理。

注意:从命令行来看,脚本也变成了守护进程

I have perl script which gets spawned from a cgi page and becomes a daemon process running on its own. If there is a die called from any module it is using, the script is getting called although it has been handled in eval block. Though, when I am running the script from the command prompt, everything is fine and the error is getting handled.

Note: From the command line also the script is becoming a daemon

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

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

发布评论

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

评论(1

内心荒芜 2024-12-27 12:57:36

抱歉,这里没有真正的答案,但有些事情需要研究...

如果您从 mod_perl 生成一个作业,请记住它比平常更复杂。您需要关闭文件描述符,httpd/mod_perl 将不仅仅打开 0、1 和 2 个文件描述符。我们最终编写了一个从 0 到 255 结束的循环。而且我认为 stdout 不是内存中的 1。

但不确定为什么 eval 不起作用。您是否使用 exec 生成脚本?在这种情况下,它应该与从 shell 运行它相同。当你说它“被杀死”时,你的意思是模具导致脚本退出(就好像没有评估一样)?或者其他什么。如果是其他东西,您可能会从运行 mod_perl 的 httpd 进程继承信号处理程序吗?

Sorry, no real answer here, but some things to look into...

If you're spawning a job from mod_perl remember its more complicated than usual. You need to close the file descriptors, httpd/mod_perl will have more than just 0, 1, and 2 open. We ended up writing a loops which just closed 0 through 255. Also I think stdout is not 1 from memory.

But not sure why eval would not be working. Are you spawning you script using exec? In which case it should be the same as running it from the shell. When you say its "getting killed" do you mean the die is causing the scirpt to exit (as if there was no eval)? Or something else. If its something else could you possibly be inheriting signal handlers from the httpd process which mod_perl is running in?

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