root/branches/feature-server/plagger/bin/plaggerldr_server.pl

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