Commit | Line | Data |
99618c49 |
1 | package [% appprefix %]::Script::Server; |
239b5fc0 |
2 | |
99618c49 |
3 | use Catalyst::Engine::HTTP; |
4 | use [% appprefix %]; |
5 | use Moose; |
239b5fc0 |
6 | |
99618c49 |
7 | with 'MooseX::GetOpt'; |
239b5fc0 |
8 | |
99618c49 |
9 | has argv => ( isa => 'ArrayRef', is => 'ro', required => 1 ); |
10 | has [qw/ fork background keepalive /] => ( isa => 'Bool', is => 'ro', required => 1, default => 0 ); |
11 | has pidfile => ( isa => 'Str', required => 0, is => 'ro' ); |
239b5fc0 |
12 | |
99618c49 |
13 | sub run { |
14 | my $self = shift; |
15 | [% appprefix %]->run( |
16 | $port, $host, |
17 | { |
18 | argv => $self->argv, |
19 | 'fork' => $self->fork, |
20 | keepalive => $self->keepalive, |
21 | background => $self->background, |
22 | pidfile => $self->pidfile, |
23 | } |
24 | ); |
25 | } |
239b5fc0 |
26 | |
239b5fc0 |
27 | |
239b5fc0 |
28 | |
b3f6c062 |
29 | __PACKAGE__->new_with_options->run; |
239b5fc0 |
30 | |
239b5fc0 |
31 | |
239b5fc0 |
32 | |
33 | 1; |
34 | |
35 | =head1 NAME |
36 | |
37 | [% appprefix %]_server.pl - Catalyst Testserver |
38 | |
39 | =head1 SYNOPSIS |
40 | |
41 | [% appprefix %]_server.pl [options] |
42 | |
43 | Options: |
44 | -d -debug force debug mode |
45 | -f -fork handle each request in a new process |
46 | (defaults to false) |
47 | -? -help display this help and exits |
48 | -host host (defaults to all) |
49 | -p -port port (defaults to 3000) |
50 | -k -keepalive enable keep-alive connections |
51 | -r -restart restart when files get modified |
52 | (defaults to false) |
53 | -rd -restartdelay delay between file checks |
54 | (ignored if you have Linux::Inotify2 installed) |
55 | -rr -restartregex regex match files that trigger |
56 | a restart when modified |
57 | (defaults to '\.yml$|\.yaml$|\.conf|\.pm$') |
58 | -restartdirectory the directory to search for |
59 | modified files, can be set mulitple times |
60 | (defaults to '[SCRIPT_DIR]/..') |
61 | -follow_symlinks follow symlinks in search directories |
62 | (defaults to false. this is a no-op on Win32) |
63 | -background run the process in the background |
64 | -pidfile specify filename for pid file |
65 | |
66 | See also: |
67 | perldoc Catalyst::Manual |
68 | perldoc Catalyst::Manual::Intro |
69 | |
70 | =head1 DESCRIPTION |
71 | |
72 | Run a Catalyst Testserver for this application. |
73 | |
74 | =head1 AUTHORS |
75 | |
76 | Catalyst Contributors, see Catalyst.pm |
77 | |
78 | =head1 COPYRIGHT |
79 | |
80 | This library is free software. You can redistribute it and/or modify |
81 | it under the same terms as Perl itself. |
82 | |
83 | =cut |