CatalystX-Script-Server-Starman

 view release on metacpan or  search on metacpan

lib/CatalystX/Script/Server/Starman.pm  view on Meta::CPAN

package CatalystX::Script::Server::Starman;
use Moose;
use MooseX::Types::Moose qw/ Str Int /;
use Pod::Usage;
use Pod::Find qw(pod_where);
use namespace::autoclean;

our $VERSION = '0.03';

extends 'Catalyst::Script::Server';

has '+fork' => ( default => 1, init_arg => undef );

has [qw/ keepalive restart restart_delay restart_regex restart_directory/] => ( init_arg => undef, is => 'ro' );

has workers => (
    isa => Int,
    is => 'ro',
    default => 5,
);

has [qw/
    min_servers
    min_spare_servers
    max_spare_servers
    max_servers
    max_requests
    backlog
/] => ( isa => Int, is => 'ro' );

has [qw/
    user
    group
/] => ( isa => Str, is => 'ro' );

around _plack_loader_args => sub {
    my ($orig, $self, @args) = @_;
    my %out = $self->$orig(@args);
    foreach my $key (qw/
        workers
        min_servers
        min_spare_servers
        max_spare_servers
        max_servers
        max_requests
        backlog
        user
        group
    /) {
        $out{$key} = $self->$key();
    }
    return %out;
};

sub print_usage_text {
    my $self = shift;
    pod2usage( -input => pod_where({-inc => 1}, __PACKAGE__), -verbose => 2 );
    exit 0;
}

1;

=head1 NAME

CatalystX::Script::Server::Starman - Replace the development server with Starman

=head1 SYNOPSIS

    myapp_server.pl [options]

       -d --debug           force debug mode
       -? --help            display this help and exits
       -h --host            host (defaults to all)
       -p --port            port (defaults to 3000)



( run in 1.866 second using v1.01-cache-2.11-cpan-39bf76dae61 )