【发布时间】:2013-05-18 22:22:55
【问题描述】:
我正在努力将 perl Web 应用程序的界面转换为 Ext 并打算使用 CGI-ExtDirect-2.02 库。
我遇到了一个问题,经过数小时的努力,仍然没有解决。
在最简单的用例中,问题是:当我将以下行添加到操作方法时,例如,添加到Demo/TestAction/getGrid,Router.pm 中出现错误。在apache 下执行或使用包含在库p5httpd.pl 服务器中时都会出现相同的错误。
当我删除 while(<FILE>) 循环时,错误消失,其他一切正常。
系统配置为:
SunOS 5.10, apache 2, perl 5.12.1.
我添加的行:
open(FILE, "</tmp/test.txt") or die("Can't open file: $!");
while (<FILE>) {
;
}
close(FILE);
错误:
5571 17:58:08 Server started on port 5000.
5571 17:58:08
5571 17:58:08 Point your browser at http://localhost:5000
5571 17:58:11 <- localhost: GET /direct-grid.html HTTP/1.1
5571 17:58:11 -> 200 OK /direct-grid.html: 803 bytes sent as text/html
5571 17:58:11 <- localhost: GET /example.css HTTP/1.1
5571 17:58:11 -> 200 OK /example.css: 1501 bytes sent as text/css
5571 17:58:11 <- localhost: GET /direct-grid.js HTTP/1.1
5571 17:58:11 -> 200 OK /direct-grid.js: 1599 bytes sent as application/x-javascript
5571 17:58:11 <- localhost: GET /cgi-bin/api.cgi HTTP/1.1
5571 17:58:11 -> exec'ing api.cgi
5571 17:58:13 <- localhost: POST /cgi-bin/router.cgi HTTP/1.1
5571 17:58:13 <- Content-length: 119, type: application/json; charset=UTF-8
5571 17:58:13 -> exec'ing router.cgi
Can't call method "result" on an undefined value at
/usr/perl5/site_perl/5.12.1/RPC/ExtDirect/Router.pm line 136.
5571 17:58:13 -> 500 Internal Server Error Premature end of script headers.
<br> Status: 65280<br>Have a look at server log for stderr output of /cgi-bin/router.cgi
【问题讨论】:
-
您确定
while循环中没有更多代码吗?看起来很像你裁剪了前面的内容;... -
就我而言,循环内的内容并不重要。
-
您是否查看了服务器日志中的
stderr输出,如错误消息的最后一行所述?这说明了什么? -
在这种情况下,所有 stderr 输出都会发送到控制台。
-
您可以提供重现此行为的最小脚本。
标签: perl extjs ext-direct