你的分享就是我们的动力 ---﹥

Perl 编写的一个简单 Web 服务器

时间:2013-05-30 00:16来源:www.chengxuyuans.com 点击:

Perl 编写的一个简单 Web 服务器

use HTTP::Daemon;  

$HTTPserver = HTTP::Daemon->new(Timeout => 600);

print "My URL is: ", $HTTPserver->url, ".\n";

while ($HTTPclient = $HTTPserver->accept) {
    $HTTPclient->autoflush(1);
    print $HTTPclient 
'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<TITLE>Welcome to my Web server! www.chengxuyuans.com</TITLE>
</HEAD>
<BODY>
<CENTER>
<H1>Welcome to my Web server!</H1>
</CENTER>

</FORM>

</BODY>

</HTML>';

$HTTPclient->close;
}

转载注明地址:http://www.chengxuyuans.com/Perl/63101.html