#!/usr/bin/perl -w use strict; use HTTP::Daemon; use CGI qw/:standard/; my $d = HTTP::Daemon->new(LocalPort => 8080) || die; while (my $c = $d->accept) { while (my $r = $c->get_request) { my $uri = $r->uri; $ENV{REQUEST_METHOD} = $r->method; $ENV{CONTENT_TYPE} = join('; ', $r->content_type) || ''; $ENV{CONTENT_LENGTH} = $r->content_length || ''; $ENV{SCRIPT_NAME} = $uri->path || 1; $ENV{QUERY_STRING} = $uri->query || ''; my $q = new CGI; my $reply; my $scriptname = $ENV{'SCRIPT_NAME'}; #$q = new CGI; if ($scriptname =~ /start/) { $reply = $q->header; open(IN,"test.htm") or die "Can't open input: $!\n"; while() { $reply .= $_; } close IN; } elsif ($scriptname eq '/process') { my @params = $q->param; $reply = $q->header; $reply .= $q->start_html.$q->h2("Parameters").join('
',@params).$q->end_html; } $c->send_response($reply); } $c->close; undef($c); } ####