Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by Anonymous Monk
on Dec 31, 2014 at 01:39 UTC ( [id://1111789]=note: print w/replies, xml ) Need Help??


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...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found