http://www.perlmonks.org?node_id=1111789


in reply to Re^2: Simple http server one-liner for some static files?
in thread Simple http server one-liner for some static files?

Joining the "better late than never"-motto, here a (long) one-liner which—in constrast to the answers before—does not require non-core modules:
perl -MHTTP::Daemon -e '$d = HTTP::Daemon->new(LocalPort => 8000) or +die $!; while ($c = $d->accept) { while ($r = $c->get_request) { +$c->send_file_response(".".$r->url->path) } }'
Actually this is a flattened and slightly modified version of HTTP::Daemon's synopsis section.

Replies are listed 'Best First'.
Re^4: Simple http server one-liner for some static files?
by Anonymous Monk on Dec 31, 2014 at 01:53 UTC
    Update to Re^3: After a short investigation with corelist HTTP::Daemon turns out that HTTP::Daemon is not a core-module. I confused that since my fresh installed Debian distribution already came along with that module...