How do I run Plack :: Runner in the background?

I am trying to start a server with Plack::Runner

. How do I run it in the background? I've tried the following:

my $runner = Plack::Runner->new;
$runner->parse_options(qw' --host 127.0.0.1 --port 90210 -D');
$runner->run($app);

      

It seems to be ignoring -D. I've also tried "-demon" and that doesn't work either.

Thank!

+3


source to share


1 answer


What is $ app ?.

my $runner = Plack::Runner->new;
$runner->parse_options(qw' --host 127.0.0.1 --port 90210 -D');
$runner->run("app.pm"); or "$app"

      

app.pm is the application file, or you can try:



my $app = sub {
    return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello World' ] ];
};

      

It works.

+3


source







All Articles