user_78361084
user_78361084

Reputation: 3928

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

I am trying to run 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 ignore the -D. I've also tried '--daemon' and that doesn't work either.

Thanks!

Upvotes: 4

Views: 534

Answers (1)

kurkop
kurkop

Reputation: 530

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 app file or you can try:

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

This works.

Upvotes: 3

Related Questions