1 package TestApp::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 pod2usage(1) if $help;
30 $ENV{CATALYST_DEBUG} = 1;
33 # If we load this here, then in the case of a restarter, it does not
34 # need to be reloaded for each restart.
37 # If this isn't done, then the Catalyst::Devel tests for the restarter
39 $| = 1 if $ENV{HARNESS_ACTIVE};
42 # This is require instead of use so that the above environment
43 # variables can be set at runtime.
51 keepalive => $keepalive,
52 background => $background,
59 die "Cannot run in the background and also watch for changed files.\n"
62 require Catalyst::Restarter;
64 my $subclass = Catalyst::Restarter->pick_subclass;
67 $args{follow_symlinks} = 1
69 $args{directories} = $watch_directory
70 if defined $watch_directory;
71 $args{sleep_interval} = $check_interval
72 if defined $check_interval;
73 $args{filter} = qr/$file_regex/
74 if defined $file_regex;
76 my $restarter = $subclass->new(
81 $restarter->run_and_watch;
87 __PACKAGE__->new_with_options->run;
95 testapp_server.pl - Catalyst Testserver
99 testapp_server.pl [options]
102 -d -debug force debug mode
103 -f -fork handle each request in a new process
105 -? -help display this help and exits
106 -host host (defaults to all)
107 -p -port port (defaults to 3000)
108 -k -keepalive enable keep-alive connections
109 -r -restart restart when files get modified
111 -rd -restartdelay delay between file checks
112 (ignored if you have Linux::Inotify2 installed)
113 -rr -restartregex regex match files that trigger
114 a restart when modified
115 (defaults to '\.yml$|\.yaml$|\.conf|\.pm$')
116 -restartdirectory the directory to search for
117 modified files, can be set mulitple times
118 (defaults to '[SCRIPT_DIR]/..')
119 -follow_symlinks follow symlinks in search directories
120 (defaults to false. this is a no-op on Win32)
121 -background run the process in the background
122 -pidfile specify filename for pid file
125 perldoc Catalyst::Manual
126 perldoc Catalyst::Manual::Intro
130 Run a Catalyst Testserver for this application.
134 Catalyst Contributors, see Catalyst.pm
138 This library is free software. You can redistribute it and/or modify
139 it under the same terms as Perl itself.