Permalink
Browse files

rename Plack::Server::Coro to Corona

  • Loading branch information...
1 parent dfc1b65 commit 2e4b3b9f2ba35cdeca79e2d1184881949cbe84bc @miyagawa committed Mar 11, 2010
Showing with 141 additions and 95 deletions.
  1. +4 −1 Changes
  2. +5 −4 Makefile.PL
  3. +5 −5 README
  4. +26 −0 bin/corona
  5. +52 −0 lib/Corona.pm
  6. +2 −72 lib/{Plack/Server/Coro.pm → Corona/Server.pm}
  7. +39 −0 lib/Plack/Handler/Corona.pm
  8. +1 −1 t/00_compile.t
  9. +0 −12 t/coro.t
  10. +7 −0 t/corona.t
View
@@ -1,4 +1,7 @@
-Revision history for Perl extension Plack::Server::Coro
+Revision history for Perl extension Corona
+
+0.100
+ - Renamed the software as 'Corona'
0.02 Sat Oct 24 01:27:12 PDT 2009
- Added psgi.streaming interface
View
@@ -1,11 +1,12 @@
use inc::Module::Install;
-name 'Plack-Server-Coro';
-all_from 'lib/Plack/Server/Coro.pm';
-readme_from 'lib/Plack/Server/Coro.pm';
+name 'Corona';
+all_from 'lib/Corona.pm';
+readme_from 'lib/Corona.pm';
requires 'Coro';
requires 'Net::Server::Coro', 0.5;
-requires 'Plack';
+requires 'Plack', 0.99;
build_requires 'Test::More';
+install_script 'bin/corona';
use_test_base;
auto_include_deps;
author_tests('xt');
View
@@ -1,11 +1,11 @@
NAME
- Plack::Server::Coro - Coro cooperative multithread web server
+ Corona - Coro based PSGI web server
SYNOPSIS
- plackup --server Coro
+ plackup --server Corona
DESCRIPTION
- This is a Coro based Plack web server. It uses Net::Server::Coro under
+ Corona is a Coro based Plack web server. It uses Net::Server::Coro under
the hood, which means we have coroutines (threads) for each socket,
active connections and a main loop.
@@ -15,9 +15,9 @@ DESCRIPTION
# your web application
use Coro::LWP;
- my $content = LWP::Simple:;get($url); # this yields to other threads when IO blocks
+ my $content = LWP::Simple::get($url); # this yields to other threads when IO blocks
- This server also uses Coro::AIO (and IO::AIO) if available, to send the
+ Corona also uses Coro::AIO (and IO::AIO) if available, to send the
static filehandle using sendfile(2).
The simple benchmark shows this server gives 2000 requests per second in
View
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+use strict;
+use lib "lib";
+use Plack::Runner;
+
+my $runner = Plack::Runner->new(server => 'Corona', env => 'deployment');
+$runner->parse_options(@ARGV);
+$runner->run;
+
+__END__
+
+=head1 NAME
+
+corona - Corona launcher
+
+=head1 SYNOPSIS
+
+ corona --listen :9090
+
+Run C<plackup -h> for more options.
+
+=head1 SEE ALSO
+
+L<Corona> L<plackup>
+
+=cut
View
@@ -0,0 +1,52 @@
+package Corona;
+use strict;
+use 5.008_001;
+our $VERSION = 0.1000;
+
+__END__
+
+=head1 NAME
+
+Corona - Coro based PSGI web server
+
+=head1 SYNOPSIS
+
+ plackup --server Corona
+
+=head1 DESCRIPTION
+
+Corona is a Coro based Plack web server. It uses L<Net::Server::Coro>
+under the hood, which means we have coroutines (threads) for each
+socket, active connections and a main loop.
+
+Because it's Coro based your web application can actually block with
+I/O wait as long as it yields when being blocked, to the other
+coroutine either explicitly with C<cede> or automatically (via Coro::*
+magic).
+
+ # your web application
+ use Coro::LWP;
+ my $content = LWP::Simple::get($url); # this yields to other threads when IO blocks
+
+Corona also uses L<Coro::AIO> (and L<IO::AIO>) if available, to send
+the static filehandle using sendfile(2).
+
+The simple benchmark shows this server gives 2000 requests per second
+in the simple Hello World app, and 300 requests to serve 2MB photo
+files when used with AIO modules. Brilliantly fast.
+
+This web server sets C<psgi.multithread> env var on.
+
+=head1 AUTHOR
+
+Tatsuhiko Miyagawa
+
+=head1 LICENSE
+
+This module is licensed under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<Coro> L<Net::Server::Coro> L<Coro::AIO>
+
+=cut
@@ -1,31 +1,9 @@
-package Plack::Server::Coro;
+package Corona::Server;
use strict;
use 5.008_001;
-our $VERSION = "0.02";
-use Plack::Util;
-
-sub new {
- my $class = shift;
- bless { @_ }, $class;
-}
-
-sub run {
- my($self, $app) = @_;
-
- my $server = Plack::Server::Coro::Server->new(
- host => $self->{host} || '*',
- user => $self->{user} || $>,
- group => $self->{group} || $),
- log_level => 1,
- );
- $server->{app} = $app;
- $server->run(port => $self->{port});
-}
-
-
-package Plack::Server::Coro::Server;
use base qw( Net::Server::Coro );
+use Plack::Util;
use constant HAS_AIO => !$ENV{PLACK_NO_SENDFILE} && eval "use Coro::AIO; 1";
@@ -126,54 +104,6 @@ sub _write_response {
$rouse_cb->() if $rouse_cb;
}
-package Plack::Server::Coro;
-
1;
__END__
-
-=head1 NAME
-
-Plack::Server::Coro - Coro cooperative multithread web server
-
-=head1 SYNOPSIS
-
- plackup --server Coro
-
-=head1 DESCRIPTION
-
-This is a Coro based Plack web server. It uses L<Net::Server::Coro>
-under the hood, which means we have coroutines (threads) for each
-socket, active connections and a main loop.
-
-Because it's Coro based your web application can actually block with
-I/O wait as long as it yields when being blocked, to the other
-coroutine either explicitly with C<cede> or automatically (via Coro::*
-magic).
-
- # your web application
- use Coro::LWP;
- my $content = LWP::Simple::get($url); # this yields to other threads when IO blocks
-
-This server also uses L<Coro::AIO> (and L<IO::AIO>) if available, to
-send the static filehandle using sendfile(2).
-
-The simple benchmark shows this server gives 2000 requests per second
-in the simple Hello World app, and 300 requests to serve 2MB photo
-files when used with AIO modules. Brilliantly fast.
-
-This web server sets C<psgi.multithread> env var on.
-
-=head1 AUTHOR
-
-Tatsuhiko Miyagawa
-
-=head1 LICENSE
-
-This module is licensed under the same terms as Perl itself.
-
-=head1 SEE ALSO
-
-L<Coro> L<Net::Server::Coro> L<Coro::AIO>
-
-=cut
@@ -0,0 +1,39 @@
+package Plack::Handler::Corona;
+use strict;
+use Corona::Server;
+
+sub new {
+ my $class = shift;
+ bless { @_ }, $class;
+}
+
+sub run {
+ my($self, $app) = @_;
+
+ my $server = Corona::Server->new(
+ host => $self->{host} || '*',
+ user => $self->{user} || $>,
+ group => $self->{group} || $),
+ log_level => 1,
+ );
+ $server->{app} = $app;
+ $server->run(port => $self->{port});
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Plack::Handler::Corona - Corona server adapter for Plack
+
+=head1 SYNOPSIS
+
+ plackup -s Corona --port 9091 app.psgi
+
+=head1 SEE ALSO
+
+L<Corona>
+
+=cut
View
@@ -1,4 +1,4 @@
use strict;
use Test::More tests => 1;
-BEGIN { use_ok 'Plack::Server::Coro' }
+BEGIN { use_ok 'Corona::Server' }
View
@@ -1,12 +0,0 @@
-use strict;
-use warnings;
-use Test::More;
-use Test::Requires qw(Net::Server::Coro);
-
-use FindBin;
-use Plack;
-use Plack::Test::Suite;
-
-Plack::Test::Suite->run_server_tests('Coro');
-done_testing();
-
View
@@ -0,0 +1,7 @@
+use strict;
+use Test::More;
+use Plack::Test::Suite;
+
+Plack::Test::Suite->run_server_tests('Corona');
+done_testing();
+

0 comments on commit 2e4b3b9

Please sign in to comment.