【发布时间】:2015-05-07 03:32:39
【问题描述】:
我正在编写一个快速脚本来处理提交的文件,并将该内容返回给用户。
我的测试代码如下所示:
#!/path/to/bin/perl
use strict;
use warnings;
use utf8;
use Apache2::RequestRec;
use Apache2::RequestIO;
my ( $xmlin, $accepts ) = (q{}, q{});
my $format = 'json';
# read the posted content
while (
Apache2::RequestIO::read($xmlin, 1024)
) {};
{
no warnings;
$accepts = $Apache2::RequestRec::headers_in{'Accepts'};
}
if ($accepts) {
for ($accepts) {
/application\/xml/i && do {
$format = 'xml';
last;
};
/text\/plain/i && do {
$format = 'text';
last;
};
} ## end for ($accepts)
} ## end if ($accepts)
print "format: $format; xml: $xmlin\n";
这段代码使用Undefined subroutine &Apache2::RequestIO::read编译失败
如果我注释掉while循环,代码运行正常。
不幸的是,Apache2::RequestIO 代码是通过 Apache2::XSLoader::load __PACKAGE__; 提取的,所以我无法检查实际代码....但我不明白为什么这不起作用
(是的,我也尝试过$r->read(...),但无济于事)
【问题讨论】:
-
你能发布你的 apache 配置吗?