in reply to Re^3: Simple http server one-liner for some static files?
in thread Simple http server one-liner for some static files?
If on a UNIX/Linux platform make sure to chmod +x SimpleHTTPServer.pl#!/usr/bin/env perl use HTTP::Daemon; my $port = $ARGV[0] || 8000; my $d = HTTP::Daemon->new(LocalPort => $port) or die $!; print "SimpleHTTPServer.pl listening at: ", $d->url, "\n"; while (my $c = $d->accept) { while (my $r = $c->get_request) { $c->send_file_response(".".$r->url->path); } }
The implementation (a perl script) is not a one liner, but the execution (calling the perl script) is...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Simple http server one-liner for some static files?
by afoken (Chancellor) on Oct 01, 2016 at 07:14 UTC |