I was inspired to post this after seeing perldoc.cgi this morning. Anyone care to merge them?#!/usr/bin/perl use strict; use warnings; use HTTP::Daemon; use HTTP::Status; my $perldocs = 'c:/Perl/html/'; my $n = "\n"; my $d = HTTP::Daemon->new(LocalAddr=>'localhost',LocalPort=>83) || die +; print "Listening on: <URL:", $d->url, ">\n"; while (my $c = $d->accept) { while (my $r = $c->get_request) { print $r->method." ".$r->url->path.$n; if ($r->method eq 'GET') { -e $perldocs.$r->url->path ? $c->send_file_response($perldocs.$r->url->path) : $c->send_error(RC_NOT_FOUND); } else { $c->send_error(RC_FORBIDDEN) } } $c->close; undef($c); }
|
---|
Replies are listed 'Best First'. | |
---|---|
•Re: Serve local perl docs with HTTP::Daemon
by merlyn (Sage) on Oct 11, 2004 at 19:17 UTC | |
by jfroebe (Parson) on Oct 11, 2004 at 20:17 UTC | |
by elwarren (Curate) on Oct 11, 2004 at 21:29 UTC | |
Re: Serve local perl docs with HTTP::Daemon
by petdance (Parson) on Oct 12, 2004 at 19:58 UTC |