Changeset 480 for trunk/script/epoll_server.pl
- Timestamp:
- 05/31/23 16:33:29 (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/script/epoll_server.pl
r242 r480 1 #!/usr/bin/ perl -w1 #!/usr/bin/env perl 2 2 3 BEGIN { 4 $ENV{CATALYST_ENGINE} ||= 'HTTP'; 5 $ENV{CATALYST_SCRIPT_GEN} = 30; 6 require Catalyst::Engine::HTTP; 7 } 8 9 use strict; 10 use warnings; 11 use Getopt::Long; 12 use Pod::Usage; 13 use FindBin; 14 use lib "$FindBin::Bin/../lib"; 15 16 my $debug = 0; 17 my $fork = 0; 18 my $help = 0; 19 my $host = undef; 20 my $port = 3000; 21 my $keepalive = 0; 22 my $restart = 0; 23 my $restart_delay = 1; 24 my $restart_regex = '\.yml$|\.yaml$|\.pm$'; 25 my $restart_directory = undef; 26 27 my @argv = @ARGV; 28 29 GetOptions( 30 'debug|d' => \$debug, 31 'fork' => \$fork, 32 'help|?' => \$help, 33 'host=s' => \$host, 34 'port=s' => \$port, 35 'keepalive|k' => \$keepalive, 36 'restart|r' => \$restart, 37 'restartdelay|rd=s' => \$restart_delay, 38 'restartregex|rr=s' => \$restart_regex, 39 'restartdirectory=s' => \$restart_directory, 40 ); 41 42 pod2usage(1) if $help; 43 44 if ( $restart ) { 45 $ENV{CATALYST_ENGINE} = 'HTTP::Restarter'; 46 } 47 if ( $debug ) { 48 $ENV{CATALYST_DEBUG} = 1; 3 BEGIN { 4 $ENV{CATALYST_SCRIPT_GEN} = 40; 49 5 } 50 6 51 # This is require instead of use so that the above environment 52 # variables can be set at runtime. 53 require Epoll; 54 55 Epoll->run( $port, $host, { 56 argv => \@argv, 57 'fork' => $fork, 58 keepalive => $keepalive, 59 restart => $restart, 60 restart_delay => $restart_delay, 61 restart_regex => qr/$restart_regex/, 62 restart_directory => $restart_directory, 63 } ); 7 use Catalyst::ScriptRunner; 8 Catalyst::ScriptRunner->run('Epoll', 'Server'); 64 9 65 10 1; … … 67 12 =head1 NAME 68 13 69 epoll_server.pl - Catalyst Test server14 epoll_server.pl - Catalyst Test Server 70 15 71 16 =head1 SYNOPSIS … … 73 18 epoll_server.pl [options] 74 19 75 Options: 76 -d -debug force debug mode 77 -f -fork handle each request in a new process 78 (defaults to false) 79 -? -help display this help and exits 80 -host host (defaults to all) 81 -p -port port (defaults to 3000) 82 -k -keepalive enable keep-alive connections 83 -r -restart restart when files get modified 84 (defaults to false) 85 -rd -restartdelay delay between file checks 86 -rr -restartregex regex match files that trigger 87 a restart when modified 88 (defaults to '\.yml$|\.yaml$|\.pm$') 89 -restartdirectory the directory to search for 90 modified files 91 (defaults to '../') 20 -d --debug force debug mode 21 -f --fork handle each request in a new process 22 (defaults to false) 23 -? --help display this help and exits 24 -h --host host (defaults to all) 25 -p --port port (defaults to 3000) 26 -k --keepalive enable keep-alive connections 27 -r --restart restart when files get modified 28 (defaults to false) 29 -rd --restart_delay delay between file checks 30 (ignored if you have Linux::Inotify2 installed) 31 -rr --restart_regex regex match files that trigger 32 a restart when modified 33 (defaults to '\.yml$|\.yaml$|\.conf|\.pm$') 34 --restart_directory the directory to search for 35 modified files, can be set multiple times 36 (defaults to '[SCRIPT_DIR]/..') 37 --follow_symlinks follow symlinks in search directories 38 (defaults to false. this is a no-op on Win32) 39 --background run the process in the background 40 --pidfile specify filename for pid file 92 41 93 42 See also: … … 99 48 Run a Catalyst Testserver for this application. 100 49 101 =head1 AUTHOR 50 =head1 AUTHORS 102 51 103 Sebastian Riedel, C<sri@oook.de> 104 Maintained by the Catalyst Core Team. 52 Catalyst Contributors, see Catalyst.pm 105 53 106 54 =head1 COPYRIGHT 107 55 108 This library is free software , you can redistribute it and/or modify56 This library is free software. You can redistribute it and/or modify 109 57 it under the same terms as Perl itself. 110 58 111 59 =cut 60
Note: See TracChangeset
for help on using the changeset viewer.