root/Mixxi/trunk/script/mixxi_server.pl

Revision 2067 (checked in by miyagawa, 14 years ago)

import Mixxi tinyurl

  • Property svn:executable set to *
Line 
1 #!/usr/bin/perl -w
2
3 BEGIN {
4     $ENV{CATALYST_ENGINE} ||= 'HTTP';
5     $ENV{CATALYST_SCRIPT_GEN} = 29;
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;
49 }
50
51 # This is require instead of use so that the above environment
52 # variables can be set at runtime.
53 require Mixxi;
54
55 Mixxi->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 } );
64
65 1;
66
67 =head1 NAME
68
69 mixxi_server.pl - Catalyst Testserver
70
71 =head1 SYNOPSIS
72
73 mixxi_server.pl [options]
74
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 '../')
92
93  See also:
94    perldoc Catalyst::Manual
95    perldoc Catalyst::Manual::Intro
96
97 =head1 DESCRIPTION
98
99 Run a Catalyst Testserver for this application.
100
101 =head1 AUTHOR
102
103 Sebastian Riedel, C<sri@oook.de>
104 Maintained by the Catalyst Core Team.
105
106 =head1 COPYRIGHT
107
108 This library is free software, you can redistribute it and/or modify
109 it under the same terms as Perl itself.
110
111 =cut
Note: See TracBrowser for help on using the browser.