| 1 | #!/usr/local/bin/perl -w | ||
| 2 | |||
| 3 | BEGIN { | ||
| 4 | $ENV{CATALYST_ENGINE} ||= 'HTTP'; | ||
| 5 | $ENV{CATALYST_SCRIPT_GEN} = 28; | ||
| 6 | } | ||
| 7 | |||
| 8 | use strict; | ||
| 9 | use warnings; | ||
| 10 | use Getopt::Long; | ||
| 11 | use Pod::Usage; | ||
| 12 | use FindBin; | ||
| 13 | use lib "$FindBin::Bin/../lib"; | ||
| 14 | |||
| 15 | my $debug = 0; | ||
| 16 | my $fork = 0; | ||
| 17 | my $help = 0; | ||
| 18 | my $host = undef; | ||
| 19 | my $port = 3000; | ||
| 20 | my $keepalive = 0; | ||
| 21 | my $restart = 0; | ||
| 22 | my $restart_delay = 1; | ||
| 23 | my $restart_regex = '\.yml$|\.yaml$|\.pm$'; | ||
| 24 | my $restart_directory = undef; | ||
| 25 | |||
| 26 | my @argv = @ARGV; | ||
| 27 | |||
| 28 | GetOptions( | ||
| 29 | 'debug|d' => \$debug, | ||
| 30 | 'fork' => \$fork, | ||
| 31 | 'help|?' => \$help, | ||
| 32 | 'host=s' => \$host, | ||
| 33 | 'port=s' => \$port, | ||
| 34 | 'keepalive|k' => \$keepalive, | ||
| 35 | 'restart|r' => \$restart, | ||
| 36 | 'restartdelay|rd=s' => \$restart_delay, | ||
| 37 | 'restartregex|rr=s' => \$restart_regex, | ||
| 38 | 'restartdirectory=s' => \$restart_directory, | ||
| 39 | ); | ||
| 40 | |||
| 41 | pod2usage(1) if $help; | ||
| 42 | |||
| 43 | if ( $restart ) { | ||
| 44 | $ENV{CATALYST_ENGINE} = 'HTTP::Restarter'; | ||
| 45 | } | ||
| 46 | if ( $debug ) { | ||
| 47 | $ENV{CATALYST_DEBUG} = 1; | ||
| 48 | } | ||
| 49 | |||
| 50 | # This is require instead of use so that the above environment | ||
| 51 | # variables can be set at runtime. | ||
| 52 | require ComponentUI; | ||
| 53 | |||
| 54 | ComponentUI->run( $port, $host, { | ||
| 55 | argv => \@argv, | ||
| 56 | 'fork' => $fork, | ||
| 57 | keepalive => $keepalive, | ||
| 58 | restart => $restart, | ||
| 59 | restart_delay => $restart_delay, | ||
| 60 | restart_regex => qr/$restart_regex/, | ||
| 61 | restart_directory => $restart_directory, | ||
| 62 | } ); | ||
| 63 | |||
| 64 | 1; | ||
| 65 | |||
| 66 | =head1 NAME | ||
| 67 | |||
| 68 | componentui_server.pl - Catalyst Testserver | ||
| 69 | |||
| 70 | =head1 SYNOPSIS | ||
| 71 | |||
| 72 | componentui_server.pl [options] | ||
| 73 | |||
| 74 | Options: | ||
| 75 | -d -debug force debug mode | ||
| 76 | -f -fork handle each request in a new process | ||
| 77 | (defaults to false) | ||
| 78 | -? -help display this help and exits | ||
| 79 | -host host (defaults to all) | ||
| 80 | -p -port port (defaults to 3000) | ||
| 81 | -k -keepalive enable keep-alive connections | ||
| 82 | -r -restart restart when files get modified | ||
| 83 | (defaults to false) | ||
| 84 | -rd -restartdelay delay between file checks | ||
| 85 | -rr -restartregex regex match files that trigger | ||
| 86 | a restart when modified | ||
| 87 | (defaults to '\.yml$|\.yaml$|\.pm$') | ||
| 88 | -restartdirectory the directory to search for | ||
| 89 | modified files | ||
| 90 | (defaults to '../') | ||
| 91 | |||
| 92 | See also: | ||
| 93 | perldoc Catalyst::Manual | ||
| 94 | perldoc Catalyst::Manual::Intro | ||
| 95 | |||
| 96 | =head1 DESCRIPTION | ||
| 97 | |||
| 98 | Run a Catalyst Testserver for this application. | ||
| 99 | |||
| 100 | =head1 AUTHOR | ||
| 101 | |||
| 102 | Sebastian Riedel, C<sri@oook.de> | ||
| 103 | Maintained by the Catalyst Core Team. | ||
| 104 | |||
| 105 | =head1 COPYRIGHT | ||
| 106 | |||
| 107 | This library is free software, you can redistribute it and/or modify | ||
| 108 | it under the same terms as Perl itself. | ||
| 109 | |||
| 110 | =cut |