Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^2: Simple http server one-liner for some static files?

by Ea (Chaplain)
on Jan 17, 2013 at 17:31 UTC ( #1013830=note: print w/replies, xml ) Need Help??

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

Better 2 years late, than never. :)

The only problem with having gadzillions of programs is finding the right one for you. The poster was looking for this:


which didn't make the first 2 pages of results. Written 3 months earlier than the question, it's just a wrapper around the Plack::App::Directory which was suggested in another thread, but it's simpler, like the python command in a book on D3 that sent me looking for the perl equivalent of python -m SimpleHTTPServer

perl -e 'print qq(Just another Perl Hacker\n)' # where's the irony switch?

Replies are listed 'Best First'.
Re^3: Simple http server one-liner for some static files?
by Anonymous Monk on Dec 31, 2014 at 01:39 UTC
    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.
      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...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013830]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2020-10-21 05:05 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (212 votes). Check out past polls.