聘我网

新概念招聘3.0

perl web开发如何方便地进行print调试?

vote up0vote downstar

直接

print 'abc';
exit;

500错误,必须这样

use CGI qw/header/;
print header(-type => 'text/html');
print 'abc';
exit;

相当麻烦。。

有没有快糙猛法?

 

1 个答复

vote up0vote downcheck

直接输出到STDERR,然后tail -f path_to_error_log:

print STDERR 'abc' . $/;
exit;

然后

tail -f ~/htdocs/error_log

...
[Thu Jan 19 09:19:48 2012] [error] [client 10.132.64.33] abc, referer:
...

这是最小overhead又最通用的做法

链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.