#!/usr/bin/env perl
use
lib
join
'/'
, File::Spec->splitdir(dirname(__FILE__)),
'lib'
;
use
lib
join
'/'
, File::Spec->splitdir(dirname(__FILE__)),
'..'
,
'lib'
;
eval
'use Mojo::Server::Hypnotoad'
;
die
<<EOF if $@;
It looks like you don't have the Mojolicious Framework installed.
EOF
my
$toad
= Mojo::Server::Hypnotoad->new;
my
$config
=
'hypnotoad.conf'
;
my
$help
;
GetOptions(
'config=s'
=>
sub
{
$config
=
$_
[1] },
foreground
=>
sub
{
$ENV
{HYPNOTOAD_FOREGROUND} = 1 },
help
=>
sub
{
$help
= 1 },
test
=>
sub
{
$ENV
{HYPNOTOAD_TEST} = 1 },
);
$help
= 1
unless
my
$app
=
shift
||
$ENV
{HYPNOTOAD_APP};
die
<<"EOF" if $help;
usage: $0 [OPTIONS] [APPLICATION]
hypnotoad script/myapp
hypnotoad myapp.pl
These options are available:
--config <path> Configuration file, defaults to "hypnotoad.conf" in the
same directory as the application script.
--foreground Keep manager process in foreground.
--help Show this message.
--test Test application/configuration and exit.
EOF
$toad
->run(
$app
,
$config
);