4 $ENV{CATALYST_ENGINE} ||= 'HTTP';
5 $ENV{CATALYST_SCRIPT_GEN} = 38;
6 require Catalyst::Engine::HTTP;
14 use lib "$FindBin::Bin/../lib";
16 #Need to preload, otherwise the first hit is slow
17 use CGI qw/:standard/;
24 my $port = $ENV{NDWEB_PORT} || $ENV{CATALYST_PORT} || 3000;
26 my $restart = $ENV{NDWEB_RELOAD} || $ENV{CATALYST_RELOAD} || 0;
43 'keepalive|k' => \$keepalive,
44 'restart|r' => \$restart,
45 'restartdelay|rd=s' => \$check_interval,
46 'restartregex|rr=s' => \$file_regex,
47 'restartdirectory=s@' => \$watch_directory,
48 'followsymlinks' => \$follow_symlinks,
49 'background' => \$background,
50 'pidfile=s' => \$pidfile,
53 pod2usage(1) if $help;
56 $ENV{CATALYST_DEBUG} = 1;
59 # If we load this here, then in the case of a restarter, it does not
60 # need to be reloaded for each restart.
63 # If this isn't done, then the Catalyst::Devel tests for the restarter
65 $| = 1 if $ENV{HARNESS_ACTIVE};
68 # This is require instead of use so that the above environment
69 # variables can be set at runtime.
77 keepalive => $keepalive,
78 background => $background,
85 die "Cannot run in the background and also watch for changed files.\n"
88 require Catalyst::Restarter;
90 my $subclass = Catalyst::Restarter->pick_subclass;
93 $args{follow_symlinks} = 1
95 $args{directories} = $watch_directory
96 if defined $watch_directory;
97 $args{sleep_interval} = $check_interval
98 if defined $check_interval;
99 $args{filter} = qr/$file_regex/
100 if defined $file_regex;
102 my $restarter = $subclass->new(
104 start_sub => $runner,
107 $restarter->run_and_watch;
117 ndweb_server.pl - Catalyst Testserver
121 ndweb_server.pl [options]
124 -d -debug force debug mode
125 -f -fork handle each request in a new process
127 -? -help display this help and exits
128 -host host (defaults to all)
129 -p -port port (defaults to 3000)
130 -k -keepalive enable keep-alive connections
131 -r -restart restart when files get modified
133 -rd -restartdelay delay between file checks
134 (ignored if you have Linux::Inotify2 installed)
135 -rr -restartregex regex match files that trigger
136 a restart when modified
137 (defaults to '\.yml$|\.yaml$|\.conf|\.pm$')
138 -restartdirectory the directory to search for
139 modified files, can be set mulitple times
140 (defaults to '[SCRIPT_DIR]/..')
141 -follow_symlinks follow symlinks in search directories
142 (defaults to false. this is a no-op on Win32)
143 -background run the process in the background
144 -pidfile specify filename for pid file
147 perldoc Catalyst::Manual
148 perldoc Catalyst::Manual::Intro
152 Run a Catalyst Testserver for this application.
156 Catalyst Contributors, see Catalyst.pm
160 This library is free software. You can redistribute it and/or modify
161 it under the same terms as Perl itself.