Joel Berger has published this small program to start a web server to serve local files , and it works just fine:
use Mojolicious::Lite;
@ARGV = qw(daemon);
use Cwd;
app->static->paths->[0] = getcwd;
any '/' => sub {
shift->render_static('index.html');
};
app->start;
I pre-populated the command line in @ARGVbecause I forgot to do this. When it starts, a message appears in it indicating which port he selected using 3000, if possible:
$ perl ~/bin/mojo_cwd
[Fri Mar 29 19:14:09 2013] [info] Listening at "http://*:3000".
Server available at http:
I would like this port to be programmed, so the test suite can know where to look for it, and I would prefer not to do this, breaking the output. None of my experiments were useful for this, and I think that I have always been in the wrong direction. It seems that he does not select the port before it starts, and as soon as I call start, this is its end.
.
. HTTP, Mojo, . , - , - .