fixed Server and testapp_server.pl. Test still wonky
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Script / Server.pm
CommitLineData
0ba6e8aa 1package Catalyst::Script::Server;
2
5b923b0b 3
a3ca4468 4use FindBin qw/$Bin/;
5use lib "$Bin/../lib";
6use Pod::Usage;
7use Moose;
8use Catalyst::Engine::HTTP;
9use namespace::clean -except => [ qw(meta) ];
10
11with 'MooseX::Getopt';
12
13has help => ( isa => 'Bool', is => 'ro', required => 0, default => sub { 0 } );
14has host => ( isa => 'Str', is => 'ro', required => 0 );
15has fork => ( isa => 'Bool', is => 'ro', required => 0 );
16has listen => ( isa => 'Int', is => 'ro', required => 0, default => sub{ 3000 } );
17has pidfile => ( isa => 'Str', is => 'ro', required => 0 );
18has keepalive => ( isa => 'Bool', is => 'ro', required => 0, default => sub { 0 } );
19has background => ( isa => 'Bool', is => 'ro', required => 0 );
20has app => ( isa => 'Str', is => 'ro', required => 1 );
21
22my @argv = @ARGV;
23
24sub run {
25 my $self = shift;
26
27 pod2usage() if $self->help;
28 my $app = $self->app;
29 Class::MOP::load_class($app);
30 $app->run(
31 $self->listen, $self->host,
32 {
33 'fork' => $self->fork,
34 keepalive => $self->keepalive,
35 background => $self->background,
36 pidfile => $self->pidfile,
37 }
38 );
39
40}
5b923b0b 41
5b923b0b 42
0ba6e8aa 431;