The below code will trigger some ideas.
HTTP::Daemon - http://search.cpan.org/~gaas/libwww-perl-5.837/lib/HTTP/Daemon.pm
#!/usr/bin/perl
use HTTP::Daemon;
use HTTP::Status;
my $d = HTTP::Daemon->new(
LocalAddr => 'hostname',
LocalPort => 8090,
);
#$d = HTTP::Daemon->new || die;
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') {
my $pathvar = $r->uri->path();
@exact_path = split("/",$pathvar);
$c->send_file_response(@exact_path[1]);
}
else {
$c->send_error(RC_FORBIDDEN)
}
}
$c->close;
undef($c);
}
Regards,
Vivek |