in reply to Re: Webserver Oneliner
in thread Webserver Oneliner

The above link is helpful, thanks. Should have searched first :/

Replies are listed 'Best First'.
Re^3: Webserver Oneliner
by viveksnv (Sexton) on Oct 15, 2010 at 11:09 UTC
    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