#!/usr/bin/perl # Simple HTTP server. # POE::Component::Server::HTTP is used to # implement a trivial web server. # Copyright 2004 by Rocco Caputo. Free software. # Same terms as Perl itself. Have fun! use warnings; use strict; use POE::Component::Server::HTTP; use HTTP::Status; my $httpd = POE::Component::Server::HTTP->new( Port => 8000, ContentHandler => { '/' => \&root_handler }, Headers => { Server => 'OSCON 2004' }, ); sub root_handler { my ($request, $response) = @_; $response->code(RC_OK); $response->content( "Hi, you fetched ". $request->uri ); return RC_OK; } POE::Kernel->run();