#! /usr/bin/perl
use strict;
use warnings;

# page to forward requests to
use constant LOCATION => "http://www.fabiani.net"; 

# required modules
use HTTP::Daemon;
use HTTP::Status;

# create a new http-Daemon
my $d = HTTP::Daemon->new(LocalPort => 80)
    or die "Error in setting up HTTP::Daemon: $!\n";
print "Running as: ", $d->url, "\n";

while (my $c = $d->accept) {
    while (my $r = $c->get_request) {
	$c->send_redirect( LOCATION . $r->url->path );
    } # while
    $c->close;
    undef($c);
} # while
