所以我的问题是我安装了 perl5.8,我无法安装任何额外的模块。(我是一名公务员,我必须使用服务器,因为它们没有任何权利或选择我可以在其上安装的内容,修改某些东西的过程需要数年时间)。
所以有一个小的网络服务器脚本:
use HTTP::Daemon;
use HTTP::Status;
(my $d = new HTTP::Daemon
LocalAddr => '127.0.0.1',
LocalPort => 52443
) || die;
print "Please contact me at: <URL:", $d->url, ">\n";
while (my $c = $d->accept) {
while (my $r = $c->get_request) {
if ($r->method eq 'GET' and $r->uri->path eq "/xyzzy") {
# remember, this is *not* recommended practice :-)
$c->send_file_response("D:/Script/index.html");
}
else {
$c->send_error(RC_FORBIDDEN)
}
}
$c->close;
undef($c);
}
我想返回一个像这样的json:{“Status”:“Ok”}
问候