X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FScript%2FServer.pm;h=fffde6ac4311a826b02d31fe5b947e4de1ff2a23;hb=2e81e132d82f807503b0f6acd31710a7cbfe926c;hp=06a1456b17f34d87df8178d3fc05bc16e5b2e9a0;hpb=4ebd5ecfb1fa96ab81248520c86fe28ffa145ca4;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Script/Server.pm b/lib/Catalyst/Script/Server.pm index 06a1456..fffde6a 100644 --- a/lib/Catalyst/Script/Server.pm +++ b/lib/Catalyst/Script/Server.pm @@ -11,23 +11,35 @@ use lib "$Bin/../lib"; use Pod::Usage; use Moose; #use Catalyst::Engine::HTTP; -use namespace::autoclean -except => [ qw(meta) ]; +use namespace::autoclean; with 'MooseX::Getopt'; +has debug => ( + traits => [qw(Getopt)], + cmd_aliases => 'd', + isa => 'Bool', + is => 'ro', + documentation => qq{ + -d --debug force debug mode + } + +); + has help => ( traits => [qw(Getopt)], cmd_aliases => 'h', isa => 'Bool', is => 'ro', - required => 0, - default => 0, + documentation => qq{ + -h --help display this help and exits + }, ); has host => ( isa => 'Str', is => 'ro', - required => 0, + , default => "localhost" ); @@ -36,7 +48,7 @@ has fork => ( cmd_aliases => 'f', isa => 'Bool', is => 'ro', - required => 0 + ); has listen => ( @@ -44,7 +56,7 @@ has listen => ( cmd_aliases => 'l', isa => 'Int', is => 'ro', - required => 0, + , default => "3000" ); @@ -53,7 +65,7 @@ has pidfile => ( cmd_aliases => 'pid', isa => 'Str', is => 'ro', - required => 0 + ); has keepalive => ( @@ -61,8 +73,8 @@ has keepalive => ( cmd_aliases => 'k', isa => 'Bool', is => 'ro', - required => 0, - default => 0 + , + ); has background => ( @@ -70,16 +82,15 @@ has background => ( cmd_aliases => 'bg', isa => 'Bool', is => 'ro', - required => 0 ); -## broken now, WHY?! -has app => ( +has _app => ( + reader => 'app', + init_arg => 'app', traits => [qw(NoGetopt)], isa => 'Str', is => 'ro', - required => 1, ); has restart => ( @@ -87,7 +98,7 @@ has restart => ( cmd_aliases => 'r', isa => 'Bool', is => 'ro', - required => 0 + ); has restart_delay => ( @@ -95,7 +106,7 @@ has restart_delay => ( cmd_aliases => 'rdel', isa => 'Int', is => 'ro', - required => 0 + ); has restart_regex => ( @@ -103,7 +114,7 @@ has restart_regex => ( cmd_aliases => 'rxp', isa => 'Str', is => 'ro', - required => 0 + ); has follow_symlinks => ( @@ -111,16 +122,22 @@ has follow_symlinks => ( cmd_aliases => 'sym', isa => 'Bool', is => 'ro', - required => 0 + ); +sub usage { + my ($self) = shift; + + return pod2usage(); + +} + my @argv = @ARGV; sub run { my $self = shift; - pod2usage() if $self->help; - warn "app is undef!" unless defined $self->app; + $self->usage if $self->help; my $app = $self->app; Class::MOP::load_class($app); $app->run( @@ -141,6 +158,8 @@ sub run { } +no Moose; +__PACKAGE__->meta->make_immutable; 1;