[Tokyo.pm] Re: 9月は焼肉はいかが??

Yasuo Matsumoto yasuo.matsumoto @ jalinfotec.co.jp
2000年 9月 27日 (水) 22:19:01 CDT


松本です。

現実逃避モードです。
ということで Perl Multi Control(中身はただの httpd)を考えています。
いまのところこれだけ。PERL初心者なのでなかなか進みません。
どうやら HTTP::Daemon の中身まで踏み込む必要がありそうです。

#次のJUSの勉強会は PPML ですんで、10月の例会はこのときにやりますか?


----------------- ここから ------------------
use HTTP::Daemon;
use HTTP::Status;

sub dmsg
{
  print STDERR scalar localtime,": @_\n";
}

my $d = new HTTP::Daemon LocalPort => 80;
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'){
         if ($r->url->path eq "/") {
            dmsg "index.html";
            $c->send_file("index.html");
         }
         elsif ($r->url->path eq "/xyzzy") {
            $c->send_file_response("httpd.txt");
         }
         else {
            $c->send_error(RC_FORBIDDEN);
         }
      }
      else {
         $c->send_error(RC_FORBIDDEN);
      }
   }
   $c->close;
   undef($c);
}




Tokyo-pm メーリングリストの案内