add files
|
1 |
#!/usr/bin/env perl |
2 | ||
3 |
use strict; |
|
4 |
use warnings; |
|
5 | ||
6 |
use FindBin; |
|
7 |
BEGIN { unshift @INC, "$FindBin::Bin/../lib" } |
|
8 | ||
9 |
use Getopt::Long qw(GetOptions :config no_auto_abbrev no_ignore_case); |
|
10 | ||
11 |
GetOptions |
|
12 |
'f|foreground' => sub { $ENV{HYPNOTOAD_FOREGROUND} = 1 }, |
|
13 |
'h|help' => \my $help, |
|
14 |
's|stop' => sub { $ENV{HYPNOTOAD_STOP} = 1 }, |
|
15 |
't|test' => sub { $ENV{HYPNOTOAD_TEST} = 1 }; |
|
16 | ||
17 |
die <<EOF if $help || !(my $app = shift || $ENV{HYPNOTOAD_APP}); |
|
18 |
usage: $0 [OPTIONS] [APPLICATION] |
|
19 | ||
20 |
hypnotoad script/myapp |
|
21 |
hypnotoad myapp.pl |
|
22 |
hypnotoad -f myapp.pl |
|
23 | ||
24 |
These options are available: |
|
25 |
-f, --foreground Keep manager process in foreground. |
|
26 |
-h, --help Show this message. |
|
27 |
-s, --stop Stop server gracefully. |
|
28 |
-t, --test Test application and exit. |
|
29 |
EOF |
|
30 | ||
31 |
require Mojo::Server::Hypnotoad; |
|
32 |
Mojo::Server::Hypnotoad->new->run($app); |
|
33 | ||
34 |
=encoding utf8 |
|
35 | ||
36 |
=head1 NAME |
|
37 | ||
38 |
hypnotoad - Hypnotoad HTTP and WebSocket server |
|
39 | ||
40 |
=head1 SYNOPSIS |
|
41 | ||
42 |
$ hypnotoad --help |
|
43 |
$ hypnotoad myapp.pl |
|
44 | ||
45 |
=head1 DESCRIPTION |
|
46 | ||
47 |
Start L<Mojolicious> and L<Mojolicious::Lite> applications with the |
|
48 |
L<Mojo::Server::Hypnotoad> web server. |
|
49 | ||
50 |
=head1 SEE ALSO |
|
51 | ||
52 |
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>. |
|
53 | ||
54 |
=cut |