r74698 - in /trunk/libplack-perl: ./ debian/ eg/dot-psgi/ lib/ lib/Plack/ lib/Plack/Handler/ lib/Plack/Middleware/ lib/Plack/Server/ t/Plack-Loader/ t/Plack-Middleware/
ghedo-guest at users.alioth.debian.org
ghedo-guest at users.alioth.debian.org
Wed May 18 17:48:40 UTC 2011
Author: ghedo-guest
Date: Wed May 18 17:48:28 2011
New Revision: 74698
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=74698
Log:
New upstream release
Added:
trunk/libplack-perl/eg/dot-psgi/nonblock-hello.psgi
- copied unchanged from r74697, branches/upstream/libplack-perl/current/eg/dot-psgi/nonblock-hello.psgi
Modified:
trunk/libplack-perl/Changes
trunk/libplack-perl/MANIFEST
trunk/libplack-perl/META.yml
trunk/libplack-perl/debian/changelog
trunk/libplack-perl/lib/Plack.pm
trunk/libplack-perl/lib/Plack/Handler/Apache1.pm
trunk/libplack-perl/lib/Plack/Handler/CGI.pm
trunk/libplack-perl/lib/Plack/Middleware/AccessLog.pm
trunk/libplack-perl/lib/Plack/Middleware/Lint.pm
trunk/libplack-perl/lib/Plack/Request.pm
trunk/libplack-perl/lib/Plack/Response.pm
trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm
trunk/libplack-perl/lib/Plack/Util.pm
trunk/libplack-perl/t/Plack-Loader/auto.t
trunk/libplack-perl/t/Plack-Middleware/conditionalget_writer.t
trunk/libplack-perl/t/Plack-Middleware/lint.t
Modified: trunk/libplack-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/Changes?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/Changes (original)
+++ trunk/libplack-perl/Changes Wed May 18 17:48:28 2011
@@ -1,6 +1,18 @@
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.9979 Tue May 17 09:54:03 PDT 2011
+ [BUG FIXES]
+ - Fixed Middleware::AccessLog's default %t format to match Apache's format
+ - Fixed a warning in Apache1 handler where PATH_INFO doesn't exist #204
+ - Fixed a bad test relying on new Test::More versions
+
+ [IMPROVEMENTS]
+ - Fixed Lint to accept bare in-memory filehandle per http://stackoverflow.com/questions/6011793/
+ - Added setup_env() to Plack::Handler::CGI (markstos)
+ - Added a non-blocking Hello World example in eg/dot-psgi
+ - Doc cleanup
0.9978 Wed May 4 11:29:12 PDT 2011
[TEST FIXES]
Modified: trunk/libplack-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/MANIFEST?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/MANIFEST (original)
+++ trunk/libplack-perl/MANIFEST Wed May 18 17:48:28 2011
@@ -20,6 +20,7 @@
eg/dot-psgi/frameworks/Squatting.psgi
eg/dot-psgi/Hello.psgi
eg/dot-psgi/image.psgi
+eg/dot-psgi/nonblock-hello.psgi
eg/dot-psgi/plack-req.psgi
eg/dot-psgi/runnable.psgi
eg/dot-psgi/slowapp.psgi
Modified: trunk/libplack-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/META.yml?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/META.yml (original)
+++ trunk/libplack-perl/META.yml Wed May 18 17:48:28 2011
@@ -40,4 +40,4 @@
homepage: http://plackperl.org
license: http://dev.perl.org/licenses/
repository: git://github.com/miyagawa/Plack.git
-version: 0.9978
+version: 0.9979
Modified: trunk/libplack-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/debian/changelog?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/debian/changelog (original)
+++ trunk/libplack-perl/debian/changelog Wed May 18 17:48:28 2011
@@ -1,24 +1,9 @@
-libplack-perl (0.9978-1) UNRELEASED; urgency=low
-
- TODO: Failing test t/Plack-Middleware/conditionalget_writer.t
- t/Plack-Middleware/conditionalget.t ............ ok
- # Tests were run but no plan was declared and done_testing() was not seen.
-
- # Failed test 'streaming'
- # at /usr/share/perl/5.12/Test/Builder.pm line 229.
- # Tests were run but no plan was declared and done_testing() was not seen.
-
- # Failed test 'streaming not modified'
- # at /usr/share/perl/5.12/Test/Builder.pm line 229.
- # Looks like you failed 2 tests of 2.
- t/Plack-Middleware/conditionalget_writer.t .....
- Dubious, test returned 2 (wstat 512, 0x200)
- Failed 2/2 subtests
+libplack-perl (0.9979-1) UNRELEASED; urgency=low
* New upstream release
* Bump Standards-Version to 3.9.2 (no changes needed)
- -- Alessandro Ghedini <al3xbio at gmail.com> Fri, 06 May 2011 18:46:10 +0200
+ -- Alessandro Ghedini <al3xbio at gmail.com> Wed, 18 May 2011 19:44:37 +0200
libplack-perl (0.9976-1) unstable; urgency=low
Modified: trunk/libplack-perl/lib/Plack.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack.pm?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack.pm (original)
+++ trunk/libplack-perl/lib/Plack.pm Wed May 18 17:48:28 2011
@@ -3,7 +3,7 @@
use strict;
use warnings;
use 5.008_001;
-our $VERSION = '0.9978';
+our $VERSION = '0.9979';
$VERSION = eval $VERSION;
1;
Modified: trunk/libplack-perl/lib/Plack/Handler/Apache1.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Handler/Apache1.pm?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Handler/Apache1.pm (original)
+++ trunk/libplack-perl/lib/Plack/Handler/Apache1.pm Wed May 18 17:48:28 2011
@@ -54,7 +54,7 @@
$env->{HTTP_AUTHORIZATION} = $HTTP_AUTHORIZATION;
}
- my $vpath = $env->{SCRIPT_NAME} . $env->{PATH_INFO};
+ my $vpath = $env->{SCRIPT_NAME} . ($env->{PATH_INFO} || '');
my $location = $r->location || "/";
$location =~ s{/$}{};
Modified: trunk/libplack-perl/lib/Plack/Handler/CGI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Handler/CGI.pm?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Handler/CGI.pm (original)
+++ trunk/libplack-perl/lib/Plack/Handler/CGI.pm Wed May 18 17:48:28 2011
@@ -64,6 +64,27 @@
sub run {
my ($self, $app) = @_;
+ my $env = $self->setup_env();
+
+ my $res = $app->($env);
+ if (ref $res eq 'ARRAY') {
+ $self->_handle_response($res);
+ }
+ elsif (ref $res eq 'CODE') {
+ $res->(sub {
+ $self->_handle_response($_[0]);
+ });
+ }
+ else {
+ die "Bad response $res";
+ }
+}
+
+sub setup_env {
+ my ( $self, $override_env ) = @_;
+
+ $override_env ||= {};
+
my $env = {
%ENV,
'psgi.version' => [ 1, 1 ],
@@ -75,6 +96,7 @@
'psgi.run_once' => 1,
'psgi.streaming' => 1,
'psgi.nonblocking' => 1,
+ %{ $override_env },
};
delete $env->{HTTP_CONTENT_TYPE};
@@ -90,19 +112,10 @@
$env->{PATH_INFO} = '/' . $env->{PATH_INFO};
}
- my $res = $app->($env);
- if (ref $res eq 'ARRAY') {
- $self->_handle_response($res);
- }
- elsif (ref $res eq 'CODE') {
- $res->(sub {
- $self->_handle_response($_[0]);
- });
- }
- else {
- die "Bad response $res";
- }
+ return $env;
}
+
+
sub _handle_response {
my ($self, $res) = @_;
@@ -185,6 +198,16 @@
This is a handler module to run any PSGI application as a CGI script.
+=head1 UTILITY METHODS
+
+=head2 setup_env()
+
+ my $env = Plack::Handler::CGI->setup_env();
+ my $env = Plack::Handler::CGI->setup_env(\%override_env);
+
+Sets up the PSGI environment hash for a CGI request from C<< %ENV >>> and returns it.
+You can can provide a hashref of key/value pairs to override the defaults if you would like.
+
=head1 SEE ALSO
L<Plack>
Modified: trunk/libplack-perl/lib/Plack/Middleware/AccessLog.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Middleware/AccessLog.pm?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Middleware/AccessLog.pm (original)
+++ trunk/libplack-perl/lib/Plack/Middleware/AccessLog.pm Wed May 18 17:48:28 2011
@@ -64,7 +64,7 @@
h => sub { $env->{REMOTE_ADDR} || '-' },
l => sub { '-' },
u => sub { $env->{REMOTE_USER} || '-' },
- t => sub { "[" . $strftime->("%d/%b/%Y %H:%M:%S", localtime) . "]" },
+ t => sub { "[" . $strftime->("%d/%b/%Y:%H:%M:%S %z", localtime) . "]" },
r => sub { _safe($env->{REQUEST_METHOD}) . " " . _safe($env->{REQUEST_URI}) .
" " . $env->{SERVER_PROTOCOL} },
s => sub { $status },
Modified: trunk/libplack-perl/lib/Plack/Middleware/Lint.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Middleware/Lint.pm?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Middleware/Lint.pm (original)
+++ trunk/libplack-perl/lib/Plack/Middleware/Lint.pm Wed May 18 17:48:28 2011
@@ -83,6 +83,14 @@
}
}
+sub is_possibly_fh {
+ my $fh = shift;
+
+ ref $fh eq 'GLOB' &&
+ *{$fh}{IO} &&
+ *{$fh}{IO}->can('getline');
+}
+
sub validate_res {
my ($self, $res, $streaming) = @_;
@@ -112,6 +120,7 @@
unless (@$res == 2 ||
ref $res->[2] eq 'ARRAY' ||
Plack::Util::is_real_fh($res->[2]) ||
+ is_possibly_fh($res->[2]) ||
(blessed($res->[2]) && $res->[2]->can('getline'))) {
$croak->('body should be an array ref or filehandle');
}
Modified: trunk/libplack-perl/lib/Plack/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Request.pm?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Request.pm (original)
+++ trunk/libplack-perl/lib/Plack/Request.pm Wed May 18 17:48:28 2011
@@ -2,7 +2,7 @@
use strict;
use warnings;
use 5.008_001;
-our $VERSION = '0.9978';
+our $VERSION = '0.9979';
$VERSION = eval $VERSION;
use HTTP::Headers;
Modified: trunk/libplack-perl/lib/Plack/Response.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Response.pm?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Response.pm (original)
+++ trunk/libplack-perl/lib/Plack/Response.pm Wed May 18 17:48:28 2011
@@ -1,7 +1,7 @@
package Plack::Response;
use strict;
use warnings;
-our $VERSION = '0.9978';
+our $VERSION = '0.9979';
$VERSION = eval $VERSION;
use Plack::Util::Accessor qw(body status);
@@ -271,6 +271,13 @@
expires => time + 24 * 60 * 60,
};
+=item finalize
+
+ $res->finalize;
+
+Returns the status code, headers, and body of this response as a PSGI
+response array reference.
+
=back
=head1 AUTHOR
Modified: trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm (original)
+++ trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm Wed May 18 17:48:28 2011
@@ -1,6 +1,6 @@
package Plack::Server::ServerSimple;
use strict;
-our $VERSION = '0.9978';
+our $VERSION = '0.9979';
$VERSION = eval $VERSION;
use parent qw(Plack::Handler::HTTP::Server::Simple);
Modified: trunk/libplack-perl/lib/Plack/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Util.pm?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Util.pm (original)
+++ trunk/libplack-perl/lib/Plack/Util.pm Wed May 18 17:48:28 2011
@@ -259,7 +259,7 @@
sub inline_object {
my %args = @_;
- bless {%args}, 'Plack::Util::Prototype';
+ bless \%args, 'Plack::Util::Prototype';
}
sub response_cb {
Modified: trunk/libplack-perl/t/Plack-Loader/auto.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Loader/auto.t?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Loader/auto.t (original)
+++ trunk/libplack-perl/t/Plack-Loader/auto.t Wed May 18 17:48:28 2011
@@ -1,4 +1,5 @@
use strict;
+use warnings;
use Test::More;
use Plack::Loader;
@@ -12,6 +13,7 @@
$INC{"Plack/Handler/Twiggy.pm"} = __FILE__;
sub Plack::Handler::Twiggy::new { bless {}, shift }
+no warnings 'redefine';
local *Plack::Loader::env = sub { return {} };
eval {
Modified: trunk/libplack-perl/t/Plack-Middleware/conditionalget_writer.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Middleware/conditionalget_writer.t?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Middleware/conditionalget_writer.t (original)
+++ trunk/libplack-perl/t/Plack-Middleware/conditionalget_writer.t Wed May 18 17:48:28 2011
@@ -25,21 +25,17 @@
test_psgi $handler, sub {
my $cb = shift;
- subtest 'streaming' => sub {
- my $res = $cb->( GET "http://localhost/streaming-klingklangklong" );
- is $res->code, 200, 'Response HTTP status';
- is $res->content, 'klingklangklong', 'Response content';
- };
+ my $res = $cb->( GET "http://localhost/streaming-klingklangklong" );
+ is $res->code, 200, 'Response HTTP status';
+ is $res->content, 'klingklangklong', 'Response content';
- subtest 'streaming not modified' => sub {
- # the middleware does not support streaming interface but make it at least not die
- my $res = $cb->( GET
- "http://localhost/streaming-klingklangklong",
- 'If-None-Match' => 'DEADBEEF'
- );
- is $res->code, 200, 'Response HTTP status';
- is $res->content, 'klingklangklong', 'Response content';
- };
+ # the middleware does not support streaming interface but make it at least not die
+ $res = $cb->( GET
+ "http://localhost/streaming-klingklangklong",
+ 'If-None-Match' => 'DEADBEEF'
+ );
+ is $res->code, 200, 'Response HTTP status';
+ is $res->content, 'klingklangklong', 'Response content';
};
done_testing;
Modified: trunk/libplack-perl/t/Plack-Middleware/lint.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Middleware/lint.t?rev=74698&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Middleware/lint.t (original)
+++ trunk/libplack-perl/t/Plack-Middleware/lint.t Wed May 18 17:48:28 2011
@@ -17,6 +17,13 @@
sub { return sub { shift->([ 200, [], undef ]) } },
);
+my @good = map { Plack::Middleware::Lint->wrap($_) } (
+ sub {
+ open my $io, "<", \"foo";
+ return [ 200, [ "Content-Type", "text/plain" ], $io ];
+ },
+);
+
for my $app (@bad) {
test_psgi $app, sub {
my $cb = shift;
@@ -25,4 +32,12 @@
};
}
+for my $app (@good) {
+ test_psgi $app, sub {
+ my $cb = shift;
+ my $res = $cb->(GET "/");
+ is $res->code, 200, $res->content;
+ };
+}
+
done_testing;
More information about the Pkg-perl-cvs-commits
mailing list