Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by Anonymous Monk
on Oct 14, 2010 at 02:42 UTC ( #865192=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?

Hi, yes, I found those -- thank you. Unfortunately, neither of those modules show in their Synopses how to use them to run an http server as a one-liner. If you know how to use either to do that, could you please share?

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

Replies are listed 'Best First'.
Re^3: Simple http server one-liner for some static files?
by Anonymous Monk on Oct 14, 2010 at 09:35 UTC

    It's not difficult. The "-Mxxx" option to perl loads module "xxx" and "-e" lets you supply an expression to evaluate (a command)

    perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>8080); $s->mount("/"=>{path=>"/tmp"}); $s->start'

    This serves /tmp and its sub-directories, if you don't want that you'll want wildcard=>0 as well as the path.

Re^3: Simple http server one-liner for some static files?
by Anonymous Monk on Oct 14, 2010 at 02:53 UTC
    stick with what works

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2019-08-24 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?