1 package [% appprefix %]::Script::Server;
3 use Catalyst::Engine::HTTP;
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' );
19 'fork' => $self->fork,
20 keepalive => $self->keepalive,
21 background => $self->background,
22 pidfile => $self->pidfile,
27 __PACKAGE__->new_with_options->run;
30 pod2usage(1) if $help;
33 $ENV{CATALYST_DEBUG} = 1;
36 # If we load this here, then in the case of a restarter, it does not
37 # need to be reloaded for each restart.
40 # If this isn't done, then the Catalyst::Devel tests for the restarter
42 $| = 1 if $ENV{HARNESS_ACTIVE};
45 # This is require instead of use so that the above environment
46 # variables can be set at runtime.
54 keepalive => $keepalive,
55 background => $background,
62 die "Cannot run in the background and also watch for changed files.\n"
65 require Catalyst::Restarter;
67 my $subclass = Catalyst::Restarter->pick_subclass;
70 $args{follow_symlinks} = 1
72 $args{directories} = $watch_directory
73 if defined $watch_directory;
74 $args{sleep_interval} = $check_interval
75 if defined $check_interval;
76 $args{filter} = qr/$file_regex/
77 if defined $file_regex;
79 my $restarter = $subclass->new(
84 $restarter->run_and_watch;
94 [% appprefix %]_server.pl - Catalyst Testserver
98 [% appprefix %]_server.pl [options]
101 -d -debug force debug mode
102 -f -fork handle each request in a new process
104 -? -help display this help and exits
105 -host host (defaults to all)
106 -p -port port (defaults to 3000)
107 -k -keepalive enable keep-alive connections
108 -r -restart restart when files get modified
110 -rd -restartdelay delay between file checks
111 (ignored if you have Linux::Inotify2 installed)
112 -rr -restartregex regex match files that trigger
113 a restart when modified
114 (defaults to '\.yml$|\.yaml$|\.conf|\.pm$')
115 -restartdirectory the directory to search for
116 modified files, can be set mulitple times
117 (defaults to '[SCRIPT_DIR]/..')
118 -follow_symlinks follow symlinks in search directories
119 (defaults to false. this is a no-op on Win32)
120 -background run the process in the background
121 -pidfile specify filename for pid file
124 perldoc Catalyst::Manual
125 perldoc Catalyst::Manual::Intro
129 Run a Catalyst Testserver for this application.
133 Catalyst Contributors, see Catalyst.pm
137 This library is free software. You can redistribute it and/or modify
138 it under the same terms as Perl itself.