r56497 - in /branches/upstream/libplack-perl/current: ./ eg/dot-psgi/ lib/ lib/Plack/ lib/Plack/Handler/ lib/Plack/Handler/Net/ lib/Plack/Loader/ lib/Plack/Middleware/ lib/Plack/Server/ lib/Plack/Test/ scripts/ share/ t/Plack-Handler/ t/Plack-Loader/ t/Plack-Middleware/ t/Plack-Request/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Mon Apr 19 02:12:59 UTC 2010
Author: jawnsy-guest
Date: Mon Apr 19 02:12:53 2010
New Revision: 56497
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=56497
Log:
[svn-upgrade] Integrating new upstream version, libplack-perl (0.9931)
Added:
branches/upstream/libplack-perl/current/lib/Plack/Handler/Net/
branches/upstream/libplack-perl/current/lib/Plack/Handler/Net/FastCGI.pm
branches/upstream/libplack-perl/current/lib/Plack/Loader/Delayed.pm
branches/upstream/libplack-perl/current/share/baybridge.jpg (with props)
branches/upstream/libplack-perl/current/t/Plack-Handler/net_fastcgi.t
branches/upstream/libplack-perl/current/t/Plack-Loader/delayed.t
Removed:
branches/upstream/libplack-perl/current/share/kyoto.jpg
Modified:
branches/upstream/libplack-perl/current/Changes
branches/upstream/libplack-perl/current/MANIFEST
branches/upstream/libplack-perl/current/META.yml
branches/upstream/libplack-perl/current/Makefile.PL
branches/upstream/libplack-perl/current/eg/dot-psgi/image.psgi
branches/upstream/libplack-perl/current/lib/Plack.pm
branches/upstream/libplack-perl/current/lib/Plack/Handler/Apache2.pm
branches/upstream/libplack-perl/current/lib/Plack/Handler/FCGI.pm
branches/upstream/libplack-perl/current/lib/Plack/Middleware/Lint.pm
branches/upstream/libplack-perl/current/lib/Plack/Middleware/Log4perl.pm
branches/upstream/libplack-perl/current/lib/Plack/Request.pm
branches/upstream/libplack-perl/current/lib/Plack/Response.pm
branches/upstream/libplack-perl/current/lib/Plack/Runner.pm
branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm
branches/upstream/libplack-perl/current/lib/Plack/Test/Suite.pm
branches/upstream/libplack-perl/current/scripts/plackup
branches/upstream/libplack-perl/current/t/Plack-Middleware/content_length.t
branches/upstream/libplack-perl/current/t/Plack-Request/upload-large.t
Modified: branches/upstream/libplack-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/Changes?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/Changes (original)
+++ branches/upstream/libplack-perl/current/Changes Mon Apr 19 02:12:53 2010
@@ -1,6 +1,16 @@
Revision history for Perl extension Plack
Take a look at http://github.com/miyagawa/Plack/issues for the planned changes before 1.0 release.
+
+0.9931 Fri Apr 16 23:52:27 PDT 2010
+ - replace kyoto.jpg test image file with smaller baybridge.jpg to strip down the tarball size
+ from 2.5MB to 212KB.
+
+0.9930 Tue Apr 13 20:18:06 PDT 2010
+ - Added Plack::Handler::Net::FastCGI (chansen)
+ - Made Test::TCP a hard dependency since Plack::Test needs it
+ - Added Delayed loader for Starlet and Starman (clkao)
+ - Hide logger middleware from log4perl's caller stack (haarg)
0.9929 Wed Mar 31 00:33:10 PDT 2010
- Middleware::JSONP: Simplified code and does not support IO response body type
Modified: branches/upstream/libplack-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/MANIFEST?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/MANIFEST (original)
+++ branches/upstream/libplack-perl/current/MANIFEST Mon Apr 19 02:12:53 2010
@@ -65,10 +65,12 @@
lib/Plack/Handler/FCGI.pm
lib/Plack/Handler/HTTP/Server/PSGI.pm
lib/Plack/Handler/HTTP/Server/Simple.pm
+lib/Plack/Handler/Net/FastCGI.pm
lib/Plack/Handler/Standalone.pm
lib/Plack/HTTPParser.pm
lib/Plack/HTTPParser/PP.pm
lib/Plack/Loader.pm
+lib/Plack/Loader/Delayed.pm
lib/Plack/Loader/Restarter.pm
lib/Plack/Loader/Shotgun.pm
lib/Plack/Middleware.pm
@@ -127,12 +129,12 @@
lib/Plack/Util.pm
lib/Plack/Util/Accessor.pm
Makefile.PL
-MANIFEST
+MANIFEST This list of files
META.yml
README
scripts/plackup
+share/baybridge.jpg
share/face.jpg
-share/kyoto.jpg
t/00_compile.t
t/FCGIUtils.pm
t/HTTP-Message-PSGI/utf8_req.t
@@ -144,10 +146,12 @@
t/Plack-Handler/fcgi.t
t/Plack-Handler/fcgi_client.t
t/Plack-Handler/http_server_simple.t
+t/Plack-Handler/net_fastcgi.t
t/Plack-Handler/standalone.t
t/Plack-HTTPParser-PP/simple.t
t/Plack-Loader/auto.t
t/Plack-Loader/auto_fallback.t
+t/Plack-Loader/delayed.t
t/Plack-Loader/shotgun.t
t/Plack-Middleware/access_log.t
t/Plack-Middleware/access_log_timed.t
Modified: branches/upstream/libplack-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/META.yml?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/META.yml (original)
+++ branches/upstream/libplack-perl/current/META.yml Mon Apr 19 02:12:53 2010
@@ -6,7 +6,6 @@
ExtUtils::MakeMaker: 6.42
Test::More: 0.88
Test::Requires: 0
- Test::TCP: 0.11
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
@@ -31,6 +30,7 @@
Hash::MultiValue: 0.05
LWP: 5.814
Pod::Usage: 0
+ Test::TCP: 0.11
Try::Tiny: 0
URI: 1.36
parent: 0
@@ -38,4 +38,4 @@
resources:
license: http://dev.perl.org/licenses/
repository: git://github.com/miyagawa/Plack.git
-version: 0.9929
+version: 0.9931
Modified: branches/upstream/libplack-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/Makefile.PL?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/Makefile.PL (original)
+++ branches/upstream/libplack-perl/current/Makefile.PL Mon Apr 19 02:12:53 2010
@@ -23,9 +23,9 @@
requires 'Hash::MultiValue', 0.05; # Plack::Request
requires 'HTTP::Body', 1.06; # Plack::Request
+requires 'Test::TCP', 0.11; # Plack::Test needs to be installed
build_requires 'Test::More', 0.88;
-build_requires 'Test::TCP', 0.11;
test_requires 'Test::Requires';
tests 't/*.t t/*/*.t';
Modified: branches/upstream/libplack-perl/current/eg/dot-psgi/image.psgi
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/eg/dot-psgi/image.psgi?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/eg/dot-psgi/image.psgi (original)
+++ branches/upstream/libplack-perl/current/eg/dot-psgi/image.psgi Mon Apr 19 02:12:53 2010
@@ -1,5 +1,5 @@
use File::Basename;
-my $path = $ENV{PSGI_IMAGE_FILE} || dirname(__FILE__) . "/../../share/kyoto.jpg";
+my $path = $ENV{PSGI_IMAGE_FILE} || dirname(__FILE__) . "/../../share/baybridge.jpg";
my $handler = sub {
open my $fh, "<:raw", $path or die $!;
return [ 200, [ "Content-Type" => "image/jpeg", "X-Sendfile" => $path, "Content-Length" => -s $fh ], $fh ];
Modified: branches/upstream/libplack-perl/current/lib/Plack.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack.pm?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack.pm Mon Apr 19 02:12:53 2010
@@ -3,7 +3,7 @@
use strict;
use warnings;
use 5.008_001;
-our $VERSION = '0.9929';
+our $VERSION = '0.9931';
$VERSION = eval $VERSION;
1;
Modified: branches/upstream/libplack-perl/current/lib/Plack/Handler/Apache2.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Handler/Apache2.pm?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Handler/Apache2.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Handler/Apache2.pm Mon Apr 19 02:12:53 2010
@@ -136,12 +136,23 @@
PerlSetVar psgi_app /path/to/app.psgi
</Location>
+ # Optional, preload the application in the parent like startup.pl
<Perl>
use Plack::Handler::Apache2;
Plack::Handler::Apache2->preload("/path/to/app.psgi");
</Perl>
- # Or create your own handler:
+=head1 DESCRIPTION
+
+This is a handler module to run any PSGI application with mod_perl on Apache 2.x.
+
+=head1 CREATING CUSTOM HANDLER
+
+If you want to create a custom handler that loads or creates PSGI
+applications using other means than loading from C<.psgi> files, you
+can create your own handler class and use C<call_app> class method to
+run your application.
+
package My::ModPerl::Handler;
use Plack::Handler::Apache2;
@@ -154,19 +165,6 @@
my $app = get_app();
Plack::Handler::Apache2->call_app($r, $app);
}
-
-=head1 DESCRIPTION
-
-This is a handler module to run any PSGI application with mod_perl on Apache 2.x.
-
-=head1 METHODS
-
-=head2 call_app($r, $app)
-
-The mod_perl handler in this package loads the app and calls this method. If
-you'd like to do something different, you can still make use of this module by
-preparing $r and $app in some other fashion and calling this as a class
-method.
=head1 AUTHOR
Modified: branches/upstream/libplack-perl/current/lib/Plack/Handler/FCGI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Handler/FCGI.pm?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Handler/FCGI.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Handler/FCGI.pm Mon Apr 19 02:12:53 2010
@@ -52,7 +52,7 @@
my $proc_manager;
if ($self->{listen}) {
- $self->daemon_fork if $self->{detach};
+ $self->daemon_fork if $self->{daemonize};
if ($self->{manager}) {
Plack::Util::load_class($self->{manager});
Added: branches/upstream/libplack-perl/current/lib/Plack/Handler/Net/FastCGI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Handler/Net/FastCGI.pm?rev=56497&op=file
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Handler/Net/FastCGI.pm (added)
+++ branches/upstream/libplack-perl/current/lib/Plack/Handler/Net/FastCGI.pm Mon Apr 19 02:12:53 2010
@@ -1,0 +1,285 @@
+package Plack::Handler::Net::FastCGI;
+use strict;
+use Plack::Util;
+use IO::Socket qw[];
+use Net::FastCGI::Constant qw[:common :type :flag :role :protocol_status];
+use Net::FastCGI::Protocol qw[:all];
+
+sub DEBUG () { 0 }
+
+sub new {
+ my $class = shift;
+ my $self = bless { @_ }, $class;
+ $self->{listen} ||= [ ":$self->{port}" ] if $self->{port};
+ $self->{values} ||= {
+ FCGI_MAX_CONNS => 1, # maximum number of concurrent transport connections this application will accept
+ FCGI_MAX_REQS => 1, # maximum number of concurrent requests this application will accept
+ FCGI_MPXS_CONNS => 0, # this implementation can't multiplex
+ };
+ $self;
+}
+
+sub run {
+ my ($self, $app) = @_;
+ $self->{app} = $app;
+
+ my $socket;
+ my $proto;
+ my $port;
+
+ if ($self->{listen}) {
+ $port = $self->{listen}->[0];
+ if ($port =~ s/^://) {
+ $proto = 'tcp';
+ $socket = IO::Socket::INET->new(
+ Listen => 5,
+ LocalPort => $port,
+ Reuse => 1
+ ) or die "Couldn't create listener socket: $!";
+ } else {
+ $proto = 'unix';
+ $socket = IO::Socket::UNIX->new(
+ Listen => 5,
+ Local => $port,
+ ) or die "Couldn't create UNIX listener socket: $!";
+ }
+ }
+ else {
+ (-S STDIN)
+ || die "Standard input is not a socket: specify a listen location";
+ $socket = \*STDIN;
+ $socket->autoflush(1);
+ }
+
+ $self->{server_ready}->({
+ host => 'localhost',
+ port => $port,
+ proto => $proto,
+ server_software => 'Plack::Handler::Net::FastCGI',
+ }) if $self->{server_ready} && $proto;
+
+ while (my $c = $socket->accept) {
+ $self->process_connection($c);
+ }
+}
+
+sub process_request {
+ my($self, $env, $stdin, $stdout, $stderr) = @_;
+
+ $env = {
+ %$env,
+ 'psgi.version' => [1,1],
+ 'psgi.url_scheme' => ($env->{HTTPS}||'off') =~ /^(?:on|1)$/i ? 'https' : 'http',
+ 'psgi.input' => $stdin,
+ 'psgi.errors' => $stderr,
+ 'psgi.multithread' => Plack::Util::FALSE,
+ 'psgi.multiprocess' => Plack::Util::FALSE, # xxx?
+ 'psgi.run_once' => Plack::Util::FALSE,
+ 'psgi.streaming' => Plack::Util::TRUE,
+ 'psgi.nonblocking' => Plack::Util::FALSE,
+ };
+
+ my $res = Plack::Util::run_app $self->{app}, $env;
+
+ if (ref $res eq 'ARRAY') {
+ $self->_handle_response($res, $stdout);
+ } elsif (ref $res eq 'CODE') {
+ $res->(sub {
+ $self->_handle_response($_[0], $stdout);
+ });
+ } else {
+ die "Bad response $res";
+ }
+}
+
+sub _handle_response {
+ my ($self, $res, $stdout) = @_;
+
+ my $hdrs;
+ $hdrs = "Status: $res->[0]\015\012";
+
+ my $headers = $res->[1];
+ while (my ($k, $v) = splice @$headers, 0, 2) {
+ $hdrs .= "$k: $v\015\012";
+ }
+ $hdrs .= "\015\012";
+
+ print {$stdout} $hdrs;
+
+ my $cb = sub { print {$stdout} $_[0] };
+ my $body = $res->[2];
+ if (defined $body) {
+ Plack::Util::foreach($body, $cb);
+ }
+ else {
+ return Plack::Util::inline_object
+ write => $cb,
+ close => sub { };
+ }
+}
+
+sub read_record {
+ @_ == 1 || die(q/Usage: read_record(io)/);
+ my ($io) = @_;
+ no warnings 'uninitialized';
+ read($io, my $header, FCGI_HEADER_LEN) == FCGI_HEADER_LEN
+ || return;
+ my ($type, $request_id, $clen, $plen) = parse_header($header);
+ (!$clen || read($io, my $content, $clen) == $clen)
+ && (!$plen || read($io, my $padding, $plen) == $plen)
+ || return;
+ $content = '' if !$clen;
+ return ($type, $request_id, $content);
+}
+
+sub process_connection {
+ my($self, $socket) = @_;
+
+ my ( $current_id, # id of the request we are currently processing
+ $stdin, # buffer for stdin
+ $stdout, # buffer for stdout
+ $stderr, # buffer for stderr
+ $params, # buffer for params (environ)
+ $output, # buffer for output
+ $done, # done with connection?
+ $keep_conn ); # more requests on this connection?
+
+ ($current_id, $stdin, $stdout, $stderr) = (0, '', '', '');
+
+ while (!$done) {
+ my ($type, $request_id, $content) = read_record($socket)
+ or last;
+
+ if (DEBUG) {
+ warn '< ', dump_record($type, $request_id, $content), "\n";
+ }
+
+ if ($request_id == FCGI_NULL_REQUEST_ID) {
+ if ($type == FCGI_GET_VALUES) {
+ my $query = parse_params($content);
+ my %reply = map { $_ => $self->{values}->{$_} }
+ grep { exists $self->{values}->{$_} }
+ keys %$query;
+ $output = build_record(FCGI_GET_VALUES_RESULT,
+ FCGI_NULL_REQUEST_ID, build_params(\%reply));
+ }
+ else {
+ $output = build_unknown_type_record($type);
+ }
+ }
+ elsif ($request_id != $current_id && $type != FCGI_BEGIN_REQUEST) {
+ # ignore inactive requests (FastCGI Specification 3.3)
+ }
+ elsif ($type == FCGI_ABORT_REQUEST) {
+ $current_id = 0;
+ ($stdin, $stdout, $stderr, $params) = ('', '', '', '');
+ }
+ elsif ($type == FCGI_BEGIN_REQUEST) {
+ my ($role, $flags) = parse_begin_request_body($content);
+ if ($current_id || $role != FCGI_RESPONDER) {
+ $output = build_end_request_record($request_id, 0,
+ $current_id ? FCGI_CANT_MPX_CONN : FCGI_UNKNOWN_ROLE);
+ }
+ else {
+ $current_id = $request_id;
+ $keep_conn = ($flags & FCGI_KEEP_CONN);
+ }
+ }
+ elsif ($type == FCGI_PARAMS) {
+ $params .= $content;
+ }
+ elsif ($type == FCGI_STDIN) {
+ $stdin .= $content;
+
+ unless (length $content) {
+ open(my $in, '<', \$stdin)
+ || die(qq/Couldn't open scalar as fh: '$!'/);
+
+ open(my $out, '>', \$stdout)
+ || die(qq/Couldn't open scalar as fh: '$!'/);
+
+ open(my $err, '>', \$stderr)
+ || die(qq/Couldn't open scalar as fh: '$!'/);
+
+ $self->process_request(parse_params($params), $in, $out, $err);
+
+ $done = 1 unless $keep_conn;
+ $output = build_end_request($request_id, 0,
+ FCGI_REQUEST_COMPLETE, $stdout, $stderr);
+
+ # prepare for next request
+ $current_id = 0;
+ ($stdin, $stdout, $stderr, $params) = ('', '', '', '');
+ }
+ }
+ else {
+ warn(qq/Received an unknown record type '$type'/);
+ }
+
+ if ($output) {
+ print {$socket} $output
+ || die(qq/Couldn't write: '$!'/);
+
+ if (DEBUG) {
+ while (length $output) {
+ my ($type, $rid, $clen, $plen) = parse_header($output);
+ my $content = substr($output, FCGI_HEADER_LEN, $clen);
+ warn '> ', dump_record($type, $rid, $content), "\n";
+ substr($output, 0, FCGI_HEADER_LEN + $clen + $plen, '');
+ }
+ }
+
+ $output = '';
+ }
+ }
+
+ if (DEBUG && !$done && $!) {
+ warn(qq/Request was prematurely aborted: '$!'/);
+ }
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Plack::Handler::Net::FastCGI - FastCGI handler for Plack using Net::FastCGI
+
+=head1 SYNOPSIS
+
+ # Run as a standalone daemon using TCP port
+ plackup -s Net::FastCGI --listen :9090
+
+=head1 DESCRIPTION
+
+This is a handler module to run any PSGI application as a standalone
+FastCGI daemon using L<Net::FastCGI>
+
+=head2 OPTIONS
+
+=over 4
+
+=item listen
+
+ listen => ':8080'
+
+Listen on a socket path, hostname:port, or :port.
+
+=item port
+
+listen via TCP on port on all interfaces (Same as C<< listen => ":$port" >>)
+
+=back
+
+=head1 AUTHORS
+
+Christian Hansesn
+
+Tatsuhiko Miyagawa
+
+=head1 SEE ALSO
+
+L<Plack::Handler::FCGI>
+
+=cut
Added: branches/upstream/libplack-perl/current/lib/Plack/Loader/Delayed.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Loader/Delayed.pm?rev=56497&op=file
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Loader/Delayed.pm (added)
+++ branches/upstream/libplack-perl/current/lib/Plack/Loader/Delayed.pm Mon Apr 19 02:12:53 2010
@@ -1,0 +1,70 @@
+package Plack::Loader::Delayed;
+use strict;
+use parent qw(Plack::Loader);
+
+sub preload_app {
+ my($self, $builder) = @_;
+ $self->{builder} = $builder;
+}
+
+sub run {
+ my($self, $server) = @_;
+
+ my $compiled;
+ my $app = sub {
+ $compiled ||= $self->{builder}->();
+ $compiled->(@_);
+ };
+
+ $server->{psgi_app_builder} = $self->{builder};
+ $server->run($app);
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Plack::Loader::Delayed - Delay the loading of .psgi until the first run
+
+=head1 SYNOPSIS
+
+ plackup -s Starlet -L Delayed myapp.psgi
+
+=head1 DESCRIPTION
+
+This loader delays the compilation of specified PSGI application until
+the first request time. This prevents bad things from happening with
+preforking web servers like L<Starlet>, when your application
+manipulates resources such as sockets or database connections in the
+master startup process and then shared by children.
+
+You can combine this loader with C<-M> command line option, like:
+
+ plackup -s Starlet -MCatalyst -L Delayed myapp.psgi
+
+loads the module Catalyst in the master process for the better process
+management with copy-on-write, however the application C<myapp.psgi>
+is loaded per children.
+
+L<Starman> since version 0.2000 loads this loader by default unless
+you specify the command line option C<--preload-app> for the
+L<starman> executable.
+
+=head1 DEVELOPERS
+
+Web server developers can make use of C<psgi_app_builder> attribute
+callback set in Plack::Handler, to load the application earlier than
+the first request time.
+
+=head1 AUTHOR
+
+Tatsuhiko Miyagawa
+
+=head1 SEE ALSO
+
+L<plackup>
+
+=cut
+
Modified: branches/upstream/libplack-perl/current/lib/Plack/Middleware/Lint.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Middleware/Lint.pm?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware/Lint.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware/Lint.pm Mon Apr 19 02:12:53 2010
@@ -127,12 +127,15 @@
my $app = sub { ... }; # your app or middleware
$app = Plack::Middleware::Lint->wrap($app);
+ # Or from plackup
+ plackup -e 'enable "Lint"' myapp.psgi
+
=head1 DESCRIPTION
Plack::Middleware::Lint is a middleware component to validate request
-and response environment. You are strongly suggested to use enable
-this middleware when you develop a framework adapter or a new server
-that implements PSGI interface.
+and response environment formats. You are strongly suggested to use
+this middleware when you develop a new framework adapter or a new PSGI
+web server that implements the PSGI interface.
=head1 AUTHOR
@@ -140,5 +143,9 @@
Tokuhiro Matsuno
+=head1 SEE ALSO
+
+L<Plack>
+
=cut
Modified: branches/upstream/libplack-perl/current/lib/Plack/Middleware/Log4perl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Middleware/Log4perl.pm?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware/Log4perl.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware/Log4perl.pm Mon Apr 19 02:12:53 2010
@@ -21,6 +21,8 @@
$env->{'psgix.logger'} = sub {
my $args = shift;
my $level = $args->{level};
+ local $Log::Log4perl::caller_depth
+ = $Log::Log4perl::caller_depth + 1;
$self->logger->$level($args->{message});
};
Modified: branches/upstream/libplack-perl/current/lib/Plack/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Request.pm?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Request.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Request.pm Mon Apr 19 02:12:53 2010
@@ -2,7 +2,7 @@
use strict;
use warnings;
use 5.008_001;
-our $VERSION = '0.9929';
+our $VERSION = '0.9931';
$VERSION = eval $VERSION;
use HTTP::Headers;
Modified: branches/upstream/libplack-perl/current/lib/Plack/Response.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Response.pm?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Response.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Response.pm Mon Apr 19 02:12:53 2010
@@ -1,7 +1,7 @@
package Plack::Response;
use strict;
use warnings;
-our $VERSION = '0.9929';
+our $VERSION = '0.9931';
$VERSION = eval $VERSION;
use Plack::Util::Accessor qw(body status);
Modified: branches/upstream/libplack-perl/current/lib/Plack/Runner.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Runner.pm?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Runner.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Runner.pm Mon Apr 19 02:12:53 2010
@@ -188,9 +188,10 @@
push @{$self->{options}}, server_ready => sub {
my($args) = @_;
- my $name = $args->{server_software} || ref($args); # $args is $server
- my $host = $args->{host} || 0;
- print STDERR "$name: Accepting connections at http://$host:$args->{port}/\n";
+ my $name = $args->{server_software} || ref($args); # $args is $server
+ my $host = $args->{host} || 0;
+ my $proto = $args->{proto} || 'http';
+ print STDERR "$name: Accepting connections at $proto://$host:$args->{port}/\n";
};
$app;
Modified: branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm Mon Apr 19 02:12:53 2010
@@ -1,6 +1,6 @@
package Plack::Server::ServerSimple;
use strict;
-our $VERSION = '0.9929';
+our $VERSION = '0.9931';
$VERSION = eval $VERSION;
use parent qw(Plack::Handler::HTTP::Server::Simple);
Modified: branches/upstream/libplack-perl/current/lib/Plack/Test/Suite.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Test/Suite.pm?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Test/Suite.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Test/Suite.pm Mon Apr 19 02:12:53 2010
@@ -161,15 +161,15 @@
'bigger file',
sub {
my $cb = shift;
- my $res = $cb->(GET "http://127.0.0.1/kyoto.jpg");
+ my $res = $cb->(GET "http://127.0.0.1/baybridge.jpg");
is $res->code, 200;
is $res->header('content_type'), 'image/jpeg';
- is length $res->content, 2397701;
- is Digest::MD5::md5_hex($res->content), '9c6d7249a77204a88be72e9b2fe279e8';
- },
- sub {
- my $env = shift;
- open my $fh, '<', "$share_dir/kyoto.jpg";
+ is length $res->content, 79838;
+ is Digest::MD5::md5_hex($res->content), '983726ae0e4ce5081bef5fb2b7216950';
+ },
+ sub {
+ my $env = shift;
+ open my $fh, '<', "$share_dir/baybridge.jpg";
binmode $fh;
return [
200,
@@ -673,13 +673,29 @@
1;
__END__
+=head1 NAME
+
+Plack::Test::Suite - Test suite for Plack handlers
+
=head1 SYNOPSIS
- # TBD See t/Plack-Servet/*.t for now
+ use Test::More;
+ use Plack::Test::Suite;
+ Plack::Test::Suite->run_server_tests('Your::Handler');
+ done_testing;
=head1 DESCRIPTION
-Plack::Test::Suite is a test suite to test a new PSGI server implementation.
+Plack::Test::Suite is a test suite to test a new PSGI server
+implementation. It automatically loads a new handler environment and
+uses LWP to send HTTP requests to the local server to make sure your
+handler implements the PSGI specification correctly.
+
+Note that the handler name doesn't include the C<Plack::Handler::>
+prefix, i.e. if you have a new Plack handler Plack::Handler::Foo, your
+test script would look like:
+
+ Plack::Test::Suite->run_server_tests('Foo');
=head1 AUTHOR
Modified: branches/upstream/libplack-perl/current/scripts/plackup
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/scripts/plackup?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/scripts/plackup (original)
+++ branches/upstream/libplack-perl/current/scripts/plackup Mon Apr 19 02:12:53 2010
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!perl
use strict;
use lib "lib";
use Plack::Runner;
@@ -96,7 +96,7 @@
Select a specific implementation to run on using the C<PLACK_SERVER>
environment variable or use the C<-s> or C<--server> flag which will
-be prefered over the environment variable if present.
+be preferred over the environment variable if present.
=item -S, --socket
Added: branches/upstream/libplack-perl/current/share/baybridge.jpg
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/share/baybridge.jpg?rev=56497&op=file
==============================================================================
Binary file - no diff available.
Propchange: branches/upstream/libplack-perl/current/share/baybridge.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: branches/upstream/libplack-perl/current/t/Plack-Handler/net_fastcgi.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Handler/net_fastcgi.t?rev=56497&op=file
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Handler/net_fastcgi.t (added)
+++ branches/upstream/libplack-perl/current/t/Plack-Handler/net_fastcgi.t Mon Apr 19 02:12:53 2010
@@ -1,0 +1,33 @@
+use strict;
+use warnings;
+use Test::More;
+use Test::Requires { 'Net::FastCGI' => 0.11, 'FCGI::Client' => 0.04 };
+use Plack::Handler::Net::FastCGI;
+use Test::TCP;
+use Plack::Test::Suite;
+use t::FCGIUtils;
+
+my $http_port;
+my $fcgi_port;
+
+test_fcgi_standalone(
+ sub {
+ ($http_port, $fcgi_port) = @_;
+ Plack::Test::Suite->run_server_tests(\&run_server, $fcgi_port, $http_port);
+ done_testing();
+ }
+);
+
+sub run_server {
+ my($port, $app) = @_;
+
+ $| = 0; # Test::Builder autoflushes this. reset!
+
+ my $server = Plack::Handler::Net::FastCGI->new(
+ host => '127.0.0.1',
+ port => $port,
+ );
+ $server->run($app);
+}
+
+
Added: branches/upstream/libplack-perl/current/t/Plack-Loader/delayed.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Loader/delayed.t?rev=56497&op=file
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Loader/delayed.t (added)
+++ branches/upstream/libplack-perl/current/t/Plack-Loader/delayed.t Mon Apr 19 02:12:53 2010
@@ -1,0 +1,28 @@
+use strict;
+use Test::More;
+use Plack::Loader;
+
+my $compiled;
+
+my $builder = sub {
+ $compiled = 1;
+ my $app = sub {
+ return [ 200, [], [ "Hi" ] ];
+ };
+};
+
+# The following eval might not fail if you set PLACK_SEVER
+delete $ENV{PLACK_SERVER};
+
+eval {
+ my $loader = Plack::Loader::Delayed->new;
+ $loader->preload_app($builder);
+ my $server = $loader->auto;
+ ok(!$compiled);
+};
+
+ok 1 if $@;
+
+done_testing;
+
+
Modified: branches/upstream/libplack-perl/current/t/Plack-Middleware/content_length.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Middleware/content_length.t?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Middleware/content_length.t (original)
+++ branches/upstream/libplack-perl/current/t/Plack-Middleware/content_length.t Mon Apr 19 02:12:53 2010
@@ -10,11 +10,11 @@
},
{
app => sub {
- open my $fh, "<", "share/kyoto.jpg";
+ open my $fh, "<", "share/baybridge.jpg";
[ 200, [ 'Content-Type' => 'image/jpeg' ], $fh ];
},
env => { REQUEST_METHOD => 'GET' },
- headers => [ 'Content-Type' => 'image/jpeg', 'Content-Length' => 2397701 ],
+ headers => [ 'Content-Type' => 'image/jpeg', 'Content-Length' => 79838 ],
},
{
app => sub {
Modified: branches/upstream/libplack-perl/current/t/Plack-Request/upload-large.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Request/upload-large.t?rev=56497&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Request/upload-large.t (original)
+++ branches/upstream/libplack-perl/current/t/Plack-Request/upload-large.t Mon Apr 19 02:12:53 2010
@@ -5,7 +5,7 @@
use Plack::Test;
use HTTP::Request::Common;
-my $file = "share/kyoto.jpg";
+my $file = "share/baybridge.jpg";
my @backends = qw( Server MockHTTP );
sub flip_backend { $Plack::Test::Impl = shift @backends }
@@ -14,7 +14,7 @@
my $req = Plack::Request->new(shift);
is $req->uploads->{image}->size, -s $file;
is $req->uploads->{image}->content_type, 'image/jpeg';
- is $req->uploads->{image}->basename, 'kyoto.jpg';
+ is $req->uploads->{image}->basename, 'baybridge.jpg';
$req->new_response(200)->finalize;
};
More information about the Pkg-perl-cvs-commits
mailing list