1 |
dpavlin |
83 |
#!/usr/bin/perl -w |
2 |
|
|
|
3 |
|
|
BEGIN { |
4 |
|
|
$ENV{CATALYST_ENGINE} ||= 'HTTP'; |
5 |
|
|
$ENV{CATALYST_SCRIPT_GEN} = 12; |
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 $restart = 0; |
20 |
|
|
my $restart_delay = 1; |
21 |
|
|
my $restart_regex = '\.yml$|\.yaml$|\.pm$'; |
22 |
|
|
|
23 |
|
|
my @argv = @ARGV; |
24 |
|
|
|
25 |
|
|
GetOptions( |
26 |
|
|
'debug|d' => \$debug, |
27 |
|
|
'fork' => \$fork, |
28 |
|
|
'help|?' => \$help, |
29 |
|
|
'host=s' => \$host, |
30 |
|
|
'port=s' => \$port, |
31 |
|
|
'restart|r' => \$restart, |
32 |
|
|
'restartdelay|rd=s' => \$restart_delay, |
33 |
|
|
'restartregex|rr=s' => \$restart_regex |
34 |
|
|
); |
35 |
|
|
|
36 |
|
|
pod2usage(1) if $help; |
37 |
|
|
|
38 |
|
|
if ( $restart ) { |
39 |
|
|
$ENV{CATALYST_ENGINE} = 'HTTP::Restarter'; |
40 |
|
|
} |
41 |
|
|
if ( $debug ) { |
42 |
|
|
$ENV{CATALYST_DEBUG} = 1; |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
require Webpacus; |
46 |
|
|
|
47 |
|
|
Webpacus->run( $port, $host, { |
48 |
|
|
argv => \@argv, |
49 |
|
|
'fork' => $fork, |
50 |
|
|
restart => $restart, |
51 |
|
|
restart_delay => $restart_delay, |
52 |
|
|
restart_regex => qr/$restart_regex/ |
53 |
|
|
} ); |
54 |
|
|
|
55 |
|
|
1; |
56 |
|
|
|
57 |
|
|
=head1 NAME |
58 |
|
|
|
59 |
|
|
webpacus_server.pl - Catalyst Testserver |
60 |
|
|
|
61 |
|
|
=head1 SYNOPSIS |
62 |
|
|
|
63 |
|
|
webpacus_server.pl [options] |
64 |
|
|
|
65 |
|
|
Options: |
66 |
|
|
-d -debug force debug mode |
67 |
|
|
-f -fork handle each request in a new process |
68 |
|
|
(defaults to false) |
69 |
|
|
-? -help display this help and exits |
70 |
|
|
-host host (defaults to all) |
71 |
|
|
-p -port port (defaults to 3000) |
72 |
|
|
-r -restart restart when files got modified |
73 |
|
|
(defaults to false) |
74 |
|
|
-rd -restartdelay delay between file checks |
75 |
|
|
-rr -restartregex regex match files that trigger |
76 |
|
|
a restart when modified |
77 |
|
|
(defaults to '\.yml$|\.yaml$|\.pm$') |
78 |
|
|
|
79 |
|
|
See also: |
80 |
|
|
perldoc Catalyst::Manual |
81 |
|
|
perldoc Catalyst::Manual::Intro |
82 |
|
|
|
83 |
|
|
=head1 DESCRIPTION |
84 |
|
|
|
85 |
|
|
Run a Catalyst Testserver for this application. |
86 |
|
|
|
87 |
|
|
=head1 AUTHOR |
88 |
|
|
|
89 |
|
|
Sebastian Riedel, C<sri@oook.de> |
90 |
|
|
|
91 |
|
|
=head1 COPYRIGHT |
92 |
|
|
|
93 |
|
|
Copyright 2004 Sebastian Riedel. All rights reserved. |
94 |
|
|
|
95 |
|
|
This library is free software, you can redistribute it and/or modify |
96 |
|
|
it under the same terms as Perl itself. |
97 |
|
|
|
98 |
|
|
=cut |