Skip to content

Commit

Permalink
Plack::Server -> Plack::Handler
Browse files Browse the repository at this point in the history
The term "Server" causes some confusions since it sounds like Server
implementations. These classes are to "Connect" Plack to Web
servers. So we call this Handler. It is called in the same term in
wsgiref and Rack, so I hope this is easier to understand for outsiders
as well.

I will commit the backward compatible layer in the next commit so the
existing code, such as mod_perl configurations and CGI script that
hardcodes "Plack::Server::CGI" would continue to work.
  • Loading branch information
miyagawa committed Jan 15, 2010
1 parent 50cd1d5 commit 8090e05
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 48 deletions.
10 changes: 5 additions & 5 deletions lib/Plack/Server.pm → lib/Plack/Handler.pm
@@ -1,4 +1,4 @@
package Plack::Server;
package Plack::Handler;
use strict;

1;
Expand All @@ -7,11 +7,11 @@ __END__
=head1 NAME
Plack::Server - Adapters for PSGI servers
Plack::Handler - Adapters for PSGI servers
=head1 SYNOPSIS
package Plack::Server::AwesomeWebServer;
package Plack::Handler::AwesomeWebServer;
sub new {
my($class, %opt) = @_;
...
Expand All @@ -35,13 +35,13 @@ Plack::Server - Adapters for PSGI servers
=head1 DESCRIPTION
Plack::Server defines an adapter interface to adapt L<plackup> and
Plack::Handler defines an adapter interface to adapt L<plackup> and
L<Plack::Runner> to various PSGI web servers, such as Apache2 for
mod_perl and Standalone for L<HTTP::Server::PSGI>.
It is an empty class, and as long as they implement the methods
defined as an Server adapter interface, they do not need to inherit
Plack::Server.
Plack::Handler.
=head1 METHODS
Expand Down
10 changes: 5 additions & 5 deletions lib/Plack/Server/Apache1.pm → lib/Plack/Handler/Apache1.pm
@@ -1,4 +1,4 @@
package Plack::Server::Apache1;
package Plack::Handler::Apache1;
use strict;
use Apache::Request;
use Apache::Constants qw(:common :response);
Expand Down Expand Up @@ -110,19 +110,19 @@ __END__
=head1 NAME
Plack::Server::Apache1 - Apache 1.3.x handlers to run PSGI application
Plack::Handler::Apache1 - Apache 1.3.x handlers to run PSGI application
=head1 SYNOPSIS
<Locaion />
SetHandler perl-script
PerlHandler Plack::Server::Apache1
PerlHandler Plack::Handler::Apache1
PerlSetVar psgi_app /path/to/app.psgi
</Location>
<Perl>
use Plack::Server::Apache1;
Plack::Server::Apache1->preload("/path/to/app.psgi");
use Plack::Handler::Apache1;
Plack::Handler::Apache1->preload("/path/to/app.psgi");
</Perl>
=head1 AUTHOR
Expand Down
10 changes: 5 additions & 5 deletions lib/Plack/Server/Apache2.pm → lib/Plack/Handler/Apache2.pm
@@ -1,4 +1,4 @@
package Plack::Server::Apache2;
package Plack::Handler::Apache2;
use strict;
use warnings;
use Apache2::RequestRec;
Expand Down Expand Up @@ -115,19 +115,19 @@ __END__
=head1 NAME
Plack::Server::Apache2 - Apache 2.0 handlers to run PSGI application
Plack::Handler::Apache2 - Apache 2.0 handlers to run PSGI application
=head1 SYNOPSIS
<Locaion />
SetHandler perl-script
PerlResponseHandler Plack::Server::Apache2
PerlResponseHandler Plack::Handler::Apache2
PerlSetVar psgi_app /path/to/app.psgi
</Location>
<Perl>
use Plack::Server::Apache2;
Plack::Server::Apache2->preload("/path/to/app.psgi");
use Plack::Handler::Apache2;
Plack::Handler::Apache2->preload("/path/to/app.psgi");
</Perl>
=head1 AUTHOR
Expand Down
12 changes: 6 additions & 6 deletions lib/Plack/Server/CGI.pm → lib/Plack/Handler/CGI.pm
@@ -1,4 +1,4 @@
package Plack::Server::CGI;
package Plack::Handler::CGI;
use strict;
use warnings;
use IO::Handle;
Expand Down Expand Up @@ -68,11 +68,11 @@ sub _handle_response {
$body->close;
}
else {
return Plack::Server::CGI::Writer->new;
return Plack::Handler::CGI::Writer->new;
}
}

package Plack::Server::CGI::Writer;
package Plack::Handler::CGI::Writer;

sub new {
return bless \do { my $x }, $_[0];
Expand Down Expand Up @@ -101,16 +101,16 @@ __END__
### Or, if you really want to be explict (NOT RECOMMENDED)
#!/usr/bin/perl
use Plack::Server::CGI;
Plack::Server::CGI->new->run($app);
use Plack::Handler::CGI;
Plack::Handler::CGI->new->run($app);
=head1 DESCRIPTION
This is a handler module to run any PSGI application as a CGI script.
=head1 SEE ALSO
L<Plack::Server>
L<Plack::Handler>
=cut
Expand Down
6 changes: 3 additions & 3 deletions lib/Plack/Server/FCGI.pm → lib/Plack/Handler/FCGI.pm
@@ -1,4 +1,4 @@
package Plack::Server::FCGI;
package Plack::Handler::FCGI;
use strict;
use warnings;
use constant RUNNING_IN_HELL => $^O eq 'MSWin32';
Expand Down Expand Up @@ -162,7 +162,7 @@ __END__
=head1 SYNOPSIS
my $server = Plack::Server::FCGI->new(
my $server = Plack::Handler::FCGI->new(
nproc => $num_proc,
listen => $listen,
detach => 1,
Expand Down Expand Up @@ -281,7 +281,7 @@ Or in the non-root path over TCP:
"check-local" => "disable"
))
Plack::Server::FCGI has a workaround for lighttpd's weird
Plack::Handler::FCGI has a workaround for lighttpd's weird
C<SCRIPT_NAME> and C<PATH_INFO> setting when you set I<check-local> to
C<disable> so both configurations (root or non-root) should work fine.
Expand Down
4 changes: 2 additions & 2 deletions lib/Plack/Server/Shotgun.pm → lib/Plack/Handler/Shotgun.pm
@@ -1,4 +1,4 @@
package Plack::Server::Shotgun;
package Plack::Handler::Shotgun;
use strict;
use Storable;
use HTTP::Server::PSGI;
Expand Down Expand Up @@ -57,7 +57,7 @@ __END__
=head1 NAME
Plack::Server::Shotgun - forking implementation of plackup
Plack::Handler::Shotgun - forking implementation of plackup
=head1 SYNOPSIS
Expand Down
@@ -1,4 +1,4 @@
package Plack::Server::Standalone;
package Plack::Handler::Standalone;
use strict;
use warnings;

Expand Down Expand Up @@ -84,7 +84,7 @@ __END__
=head1 NAME
Plack::Server::Standalone - adapters for HTTP::Server::PSGI
Plack::Handler::Standalone - adapters for HTTP::Server::PSGI
=head1 SYNOPSIS
Expand All @@ -93,7 +93,7 @@ Plack::Server::Standalone - adapters for HTTP::Server::PSGI
=head1 DESCRIPTION
Plack::Server::Standalone is an adapter for default Plack server
Plack::Handler::Standalone is an adapter for default Plack server
implementation L<HTTP::Server::PSGI>.
=head1 CONFIGURATIONS
Expand Down
6 changes: 3 additions & 3 deletions lib/Plack/Loader.pm
Expand Up @@ -8,12 +8,12 @@ sub auto {

my $server = $class->guess
or Carp::croak("Couldn't auto-guess server serverementation. Set it with PLACK_SERVER");
Plack::Util::load_class($server, "Plack::Server")->new(%args);
Plack::Util::load_class($server, "Plack::Handler")->new(%args);
}

sub load {
my($class, $server, @args) = @_;
Plack::Util::load_class($server, "Plack::Server")->new(@args);
Plack::Util::load_class($server, "Plack::Handler")->new(@args);
}

sub guess {
Expand Down Expand Up @@ -57,7 +57,7 @@ Plack::Loader - (auto)load Plack Servers
=head1 DESCRIPTION
Plack::Loader is a factory class to load one of Plack::Server subclasses based on the environment.
Plack::Loader is a factory class to load one of Plack::Handler subclasses based on the environment.
=head1 AUTOLOADING
Expand Down
2 changes: 1 addition & 1 deletion lib/Plack/Middleware/ContentLength.pm
Expand Up @@ -38,7 +38,7 @@ Plack::Middleware::ContentLength - Adds Content-Length header automatically
$app;
}
# Or in Plack::Server::*
# Or in Plack::Handler::*
$app = Plack::Middleware::ContentLength->wrap($app);
=head1 DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion lib/Plack/Middleware/Refresh.pm
Expand Up @@ -51,7 +51,7 @@ This middleware is quite similar to what Rack::Reoader does. If you
have issues with this reloading technique, for instance when you have
in-file templates that needs to be recompiled, or Moose classes that
has C<make_immutable>, take a look at L<plackup>'s default -r option
or L<Plack::Server::Shotgun> instead.
or L<Plack::Handler::Shotgun> instead.
=head1 AUTHOR
Expand Down
2 changes: 1 addition & 1 deletion lib/Plack/Runner.pm
Expand Up @@ -219,7 +219,7 @@ automatically extracted from your own script using L<Pod::Usage>.
Do not directly call this module from your C<.psgi>, since that makes
your PSGI application unnecesarily depend on L<plackup> and won't run
other backends like L<Plack::Server::Apache2> or mod_psgi.
other backends like L<Plack::Handler::Apache2> or mod_psgi.
If you I<really> want to make your C<.psgi> runnable as a standalone
script, you can do this:
Expand Down
4 changes: 2 additions & 2 deletions lib/Plack/Test.pm
Expand Up @@ -59,7 +59,7 @@ Plack::Test is an unified interface to test PSGI applications using
standard HTTP::Request and HTTP::Response objects. It also allows you
to run PSGI applications in various ways, by default using C<MockHTTP>
backend but can also use C<Server> backend, which uses one of
L<Plack::Server> implementations to run the web server to do live HTTP
L<Plack::Handler> implementations to run the web server to do live HTTP
requests.
=head1 FUNCTIONS
Expand Down Expand Up @@ -104,7 +104,7 @@ the PSGI application in-process and returns HTTP::Response.
=item Server
Runs one of Plack::Server backends (C<Standalone> by default) and
Runs one of Plack::Handler backends (C<Standalone> by default) and
sends live HTTP requests to test.
=back
Expand Down
2 changes: 1 addition & 1 deletion lib/Plack/Util/Accessor.pm
Expand Up @@ -43,4 +43,4 @@ L<PSGI> L<http://plackperl.org/>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
=cut
2 changes: 1 addition & 1 deletion t/Plack-Server/apache1.t → t/Plack-Handler/apache1.t
Expand Up @@ -74,7 +74,7 @@ Listen $port
<Location />
SetHandler perl-script
PerlHandler Plack::Server::Apache1
PerlHandler Plack::Handler::Apache1
PerlSetVar psgi_app $tmpdir/app.psgi
</Location>
END
Expand Down
6 changes: 3 additions & 3 deletions t/Plack-Server/apache2.t → t/Plack-Handler/apache2.t
Expand Up @@ -54,13 +54,13 @@ ErrorLog $tmpdir/error_log
Listen $port
<Perl>
use Plack::Server::Apache2;
Plack::Server::Apache2->preload("$tmpdir/app.psgi");
use Plack::Handler::Apache2;
Plack::Handler::Apache2->preload("$tmpdir/app.psgi");
</Perl>
<Location />
SetHandler perl-script
PerlHandler Plack::Server::Apache2
PerlHandler Plack::Handler::Apache2
PerlSetVar psgi_app $tmpdir/app.psgi
</Location>
END
Expand Down
4 changes: 2 additions & 2 deletions t/Plack-Server/cgi.t → t/Plack-Handler/cgi.t
Expand Up @@ -8,7 +8,7 @@ use FindBin;
use HTTP::Request::AsCGI;
use URI::Escape;
use Plack;
use Plack::Server::CGI;
use Plack::Handler::CGI;
use Plack::Test::Suite;

Plack::Test::Suite->runtests(sub {
Expand All @@ -20,7 +20,7 @@ Plack::Test::Suite->runtests(sub {

my $cgi = HTTP::Request::AsCGI->new($req);
my $c = $cgi->setup;
eval { Plack::Server::CGI->new->run($handler) };
eval { Plack::Handler::CGI->new->run($handler) };
my $res = $c->response;
$res->request($req);

Expand Down
4 changes: 2 additions & 2 deletions t/Plack-Server/fcgi.t → t/Plack-Handler/fcgi.t
Expand Up @@ -3,7 +3,7 @@ use warnings;
use Test::More;
use Test::Requires qw(FCGI FCGI::ProcManager);
use Plack;
use Plack::Server::FCGI;
use Plack::Handler::FCGI;
use Test::TCP;
use LWP::UserAgent;
use FindBin;
Expand All @@ -26,7 +26,7 @@ sub run_server {

$| = 0; # Test::Builder autoflushes this. reset!

my $server = Plack::Server::FCGI->new(
my $server = Plack::Handler::FCGI->new(
host => '127.0.0.1',
port => $port,
manager => '',
Expand Down
Expand Up @@ -3,7 +3,7 @@ use warnings;
use Test::More;
use Test::Requires { FCGI => 0, 'FCGI::Client' => 0.03 };
use Plack;
use Plack::Server::FCGI;
use Plack::Handler::FCGI;
use Test::TCP;
use LWP::UserAgent;
use FindBin;
Expand All @@ -29,7 +29,7 @@ sub run_server {

$| = 0; # Test::Builder autoflushes this. reset!

my $server = Plack::Server::FCGI->new(
my $server = Plack::Handler::FCGI->new(
host => '127.0.0.1',
port => $port,
manager => '',
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 8090e05

Please sign in to comment.