Permalink
Browse files

do not pass num_workers to HTTP::Server::PSGI, add tests

  • Loading branch information...
1 parent 519f766 commit 548d158ac5364f2c8bfacce3fbbac31e55907221 @kazuho committed Mar 26, 2010
Showing with 39 additions and 13 deletions.
  1. +19 −7 README
  2. +4 −2 lib/Plack/Handler/Starlet.pm
  3. +16 −4 lib/Starlet.pm
View
26 README
@@ -4,8 +4,9 @@ NAME
SYNOPSIS
% start_server --port=80 -- plackup -s Starlet [options] your-app.psgi
- OPTIONS
- --num-workers=# number of worker processes
+ or if you do not need hot deploy,
+
+ % plackup -s Starlet --port=80 [options] your-app.psgi
DESCRIPTION
Starlet is a standalone HTTP/1.0 server formerly known as
@@ -15,12 +16,17 @@ DESCRIPTION
The server supports following features, and is suitable for running HTTP
application servers behind a reverse proxy.
- - prefork and graceful shutdown using Parallel::Prefork - hot deploy
- using Server::Starter - fast HTTP processing using HTTP::Parser::XS
- (optional)
+ - prefork and graceful shutdown using Parallel::Prefork
-AUTHOR
- Kazuho Oku
+ - hot deploy using Server::Starter
+
+ - fast HTTP processing using HTTP::Parser::XS (optional)
+
+COMMAND LINE OPTIONS
+ In addition to the options supported by HTTP::Server::PSGI, Starlet
+ accepts following options(s).
+
+ --num-workers=# number of worker processes
NOTES
If you are looking for a standalone preforking HTTP server, then you
@@ -31,6 +37,12 @@ NOTES
SEE ALSO
Parallel::Prefork Starman Server::Starter
+AUTHOR
+ Kazuho Oku
+
+THANKS TO
+ miyagawa
+
LICENSE
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
@@ -10,6 +10,7 @@ use base qw(HTTP::Server::PSGI);
sub new {
my ($klass, %args) = @_;
+ # setup before instantiation
my $listen_sock;
if (defined $ENV{SERVER_STARTER_PORT}) {
my ($hostport, $fd) = %{Server::Starter::server_ports()};
@@ -25,13 +26,14 @@ sub new {
$listen_sock->fdopen($fd, 'w')
or die "failed to bind to listening socket:$!";
}
+ my $max_workers = delete($args{max_workers}) || 10;
+ # instantiate and set the variables
my $self = $klass->SUPER::new(%args);
$self->{is_multiprocess} = 1;
- $self->{max_workers} = $args{max_workers} || 10;
-
$self->{listen_sock} = $listen_sock
if $listen_sock;
+ $self->{max_workers} = $max_workers;
$self;
}
View
@@ -13,9 +13,9 @@ Starlet
% start_server --port=80 -- plackup -s Starlet [options] your-app.psgi
-=head2 OPTIONS
+ or if you do not need hot deploy,
---num-workers=# number of worker processes
+ % plackup -s Starlet --port=80 [options] your-app.psgi
=head1 DESCRIPTION
@@ -24,12 +24,16 @@ Starlet is a standalone HTTP/1.0 server formerly known as L<Plack::Server::Stand
The server supports following features, and is suitable for running HTTP application servers behind a reverse proxy.
- prefork and graceful shutdown using L<Parallel::Prefork>
+
- hot deploy using L<Server::Starter>
+
- fast HTTP processing using L<HTTP::Parser::XS> (optional)
-=head1 AUTHOR
+=head1 COMMAND LINE OPTIONS
-Kazuho Oku
+In addition to the options supported by L<HTTP::Server::PSGI>, Starlet accepts following options(s).
+
+--num-workers=# number of worker processes
=head1 NOTES
@@ -41,6 +45,14 @@ L<Parallel::Prefork>
L<Starman>
L<Server::Starter>
+=head1 AUTHOR
+
+Kazuho Oku
+
+=head1 THANKS TO
+
+miyagawa
+
=head1 LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

0 comments on commit 548d158

Please sign in to comment.