Ignore:
Timestamp:
05/31/23 16:33:29 (12 months ago)
Author:
nanardon
Message:

Update script for latest Catalyst

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/script/epoll_server.pl

    r242 r480  
    1 #!/usr/bin/perl -w 
     1#!/usr/bin/env perl 
    22 
    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; 
     3BEGIN { 
     4    $ENV{CATALYST_SCRIPT_GEN} = 40; 
    495} 
    506 
    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 } ); 
     7use Catalyst::ScriptRunner; 
     8Catalyst::ScriptRunner->run('Epoll', 'Server'); 
    649 
    65101; 
     
    6712=head1 NAME 
    6813 
    69 epoll_server.pl - Catalyst Testserver 
     14epoll_server.pl - Catalyst Test Server 
    7015 
    7116=head1 SYNOPSIS 
     
    7318epoll_server.pl [options] 
    7419 
    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 
    9241 
    9342 See also: 
     
    9948Run a Catalyst Testserver for this application. 
    10049 
    101 =head1 AUTHOR 
     50=head1 AUTHORS 
    10251 
    103 Sebastian Riedel, C<sri@oook.de> 
    104 Maintained by the Catalyst Core Team. 
     52Catalyst Contributors, see Catalyst.pm 
    10553 
    10654=head1 COPYRIGHT 
    10755 
    108 This library is free software, you can redistribute it and/or modify 
     56This library is free software. You can redistribute it and/or modify 
    10957it under the same terms as Perl itself. 
    11058 
    11159=cut 
     60 
Note: See TracChangeset for help on using the changeset viewer.