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:
Actually this is a flattened and slightly modified version of HTTP::Daemon's synopsis section.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) } }'
|
---|
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 |
In Section
Seekers of Perl Wisdom