r57566 - in /trunk/libplack-perl: ./ debian/ lib/ lib/Plack/ lib/Plack/App/ lib/Plack/Handler/ lib/Plack/Middleware/ lib/Plack/Server/ t/Plack-Handler/ t/Plack-Middleware/ t/Plack-Server/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Thu May 6 13:08:29 UTC 2010


Author: jawnsy-guest
Date: Thu May  6 13:08:19 2010
New Revision: 57566

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=57566
Log:
New upstream release

Modified:
    trunk/libplack-perl/Changes
    trunk/libplack-perl/META.yml
    trunk/libplack-perl/README
    trunk/libplack-perl/debian/changelog
    trunk/libplack-perl/debian/copyright
    trunk/libplack-perl/lib/Plack.pm
    trunk/libplack-perl/lib/Plack/App/File.pm
    trunk/libplack-perl/lib/Plack/Handler/CGI.pm
    trunk/libplack-perl/lib/Plack/Middleware/StackTrace.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/t/Plack-Handler/cgi.t
    trunk/libplack-perl/t/Plack-Middleware/order.t
    trunk/libplack-perl/t/Plack-Middleware/prefix.t
    trunk/libplack-perl/t/Plack-Middleware/stacktrace.t
    trunk/libplack-perl/t/Plack-Middleware/stacktrace_force.t
    trunk/libplack-perl/t/Plack-Middleware/stacktrace_utf8.t
    trunk/libplack-perl/t/Plack-Server/compat.t

Modified: trunk/libplack-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/Changes?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/Changes (original)
+++ trunk/libplack-perl/Changes Thu May  6 13:08:19 2010
@@ -1,6 +1,15 @@
 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.9935  Wed May  5 15:17:06 PDT 2010
+        - Set an empty PATH_INFO if CGI environment doesn't set so (hachi) #109
+        - Fixed a possible weird combination of SCRIPT_NAME and PATH_INFO in CGI handlers
+        - localize PATH_INFO and SCRIPT_NAME in App::File and subclasses #100
+        - updated COPYRIGHT notice for Debian
+        - Middleware::StackTrace now displays text trace to psgi.errors like Rack::ShowExceptions
+          (castaway, theorbtwo)
+        - Middleware::StackTrace: Fixed the text stack trace format to be more readable
 
 0.9934  Tue May  4 15:47:33 PDT 2010
         - Added a test in CGIBin where binmode ":utf8" causes bad content-length #110

Modified: trunk/libplack-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/META.yml?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/META.yml (original)
+++ trunk/libplack-perl/META.yml Thu May  6 13:08:19 2010
@@ -38,4 +38,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: git://github.com/miyagawa/Plack.git
-version: 0.9934
+version: 0.9935

Modified: trunk/libplack-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/README?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/README (original)
+++ trunk/libplack-perl/README Thu May  6 13:08:19 2010
@@ -129,6 +129,9 @@
     Tatsuhiko Miyagawa
 
 COPYRIGHT
+    The following copyright notice applies to all the files provided in this
+    distribution, including binary files, unless explicitly noted otherwise.
+
     Copyright 2009-2010 Tatsuhiko Miyagawa
 
 CONTRIBUTORS

Modified: trunk/libplack-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/debian/changelog?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/debian/changelog (original)
+++ trunk/libplack-perl/debian/changelog Thu May  6 13:08:19 2010
@@ -1,3 +1,9 @@
+libplack-perl (0.9935-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Thu, 06 May 2010 09:34:38 -0400
+
 libplack-perl (0.9934-1) unstable; urgency=low
 
   * New upstream release

Modified: trunk/libplack-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/debian/copyright?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/debian/copyright (original)
+++ trunk/libplack-perl/debian/copyright Thu May  6 13:08:19 2010
@@ -6,8 +6,6 @@
 Files: *
 Copyright: 2009-2010, Tatsuhiko Miyagawa <miyagawa at bulknews.net>
 License: Artistic or GPL-1+
-X-Comment: the author notes that this copyright statement also applies
- to binary files, including images: http://gist.github.com/391207
 
 Files: inc/Module/*
 Copyright: 2002-2010, Adam Kennedy <adamk at cpan.org>

Modified: trunk/libplack-perl/lib/Plack.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack.pm?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack.pm (original)
+++ trunk/libplack-perl/lib/Plack.pm Thu May  6 13:08:19 2010
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use 5.008_001;
-our $VERSION = '0.9934';
+our $VERSION = '0.9935';
 $VERSION = eval $VERSION;
 
 1;
@@ -166,6 +166,10 @@
 
 =head1 COPYRIGHT
 
+The following copyright notice applies to all the files provided in
+this distribution, including binary files, unless explicitly noted
+otherwise.
+
 Copyright 2009-2010 Tatsuhiko Miyagawa
 
 =head1 CONTRIBUTORS

Modified: trunk/libplack-perl/lib/Plack/App/File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/App/File.pm?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/App/File.pm (original)
+++ trunk/libplack-perl/lib/Plack/App/File.pm Thu May  6 13:08:19 2010
@@ -22,13 +22,15 @@
     my($file, $path_info) = $self->file || $self->locate_file($env);
     return $file if ref $file eq 'ARRAY';
 
+    local @{$env}{qw( SCRIPT_NAME PATH_INFO )} = @{$env}{qw( SCRIPT_NAME PATH_INFO )};
+
     if ($path_info) {
         $env->{PATH_INFO}   =~ s/\Q$path_info\E$//;
         $env->{SCRIPT_NAME} = $env->{SCRIPT_NAME} . $env->{PATH_INFO};
-        $env->{PATH_INFO }  = $path_info;
+        $env->{PATH_INFO}   = $path_info;
     } else {
         $env->{SCRIPT_NAME} = $env->{SCRIPT_NAME} . $env->{PATH_INFO};
-        $env->{PATH_INFO }  = '';
+        $env->{PATH_INFO}   = '';
     }
 
     return $self->serve_path($env, $file);

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=57566&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Handler/CGI.pm (original)
+++ trunk/libplack-perl/lib/Plack/Handler/CGI.pm Thu May  6 13:08:19 2010
@@ -23,8 +23,16 @@
 
     delete $env->{HTTP_CONTENT_TYPE};
     delete $env->{HTTP_CONTENT_LENGTH};
-    $env->{SCRIPT_NAME}     = '' if $env->{SCRIPT_NAME} eq '/';
     $env->{'HTTP_COOKIE'} ||= $ENV{COOKIE}; # O'Reilly server bug
+
+    if (!exists $env->{PATH_INFO}) {
+        $env->{PATH_INFO} = '';
+    }
+
+    if ($env->{SCRIPT_NAME} eq '/') {
+        $env->{SCRIPT_NAME} = '';
+        $env->{PATH_INFO}   = '/' . $env->{PATH_INFO};
+    }
 
     my $res = $app->($env);
     if (ref $res eq 'ARRAY') {

Modified: trunk/libplack-perl/lib/Plack/Middleware/StackTrace.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Middleware/StackTrace.pm?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Middleware/StackTrace.pm (original)
+++ trunk/libplack-perl/lib/Plack/Middleware/StackTrace.pm Thu May  6 13:08:19 2010
@@ -5,7 +5,7 @@
 use Devel::StackTrace;
 use Devel::StackTrace::AsHTML;
 use Try::Tiny;
-use Plack::Util::Accessor qw( force );
+use Plack::Util::Accessor qw( force no_print_errors );
 
 our $StackTraceClass = "Devel::StackTrace";
 
@@ -26,11 +26,13 @@
     my $caught;
     my $res = try { $self->app->($env) } catch { $caught = $_ };
 
-    if ($trace && ($caught || $self->{force} && ref $res eq 'ARRAY' && $res->[0] == 500) ) {
+    if ($trace && ($caught || ($self->force && ref $res eq 'ARRAY' && $res->[0] == 500)) ) {
+        my $text = trace_as_string($trace);
+        $env->{'psgi.errors'}->print($text) unless $self->no_print_errors;
         if (($env->{HTTP_ACCEPT} || '*/*') =~ /html/) {
             $res = [500, ['Content-Type' => 'text/html; charset=utf-8'], [ utf8_safe($trace->as_html) ]];
         } else {
-            $res = [500, ['Content-Type' => 'text/plain; charset=utf-8'], [ utf8_safe($trace->as_string) ]];
+            $res = [500, ['Content-Type' => 'text/plain; charset=utf-8'], [ utf8_safe($text) ]];
         }
     }
 
@@ -40,6 +42,21 @@
     undef $trace;
 
     return $res;
+}
+
+sub trace_as_string {
+    my $trace = shift;
+
+    my $st = '';
+    my $first = 1;
+    foreach my $f ( $trace->frames() ) {
+        $st .= "\t" unless $first;
+        $st .= $f->as_string($first) . "\n";
+        $first = 0;
+    }
+
+    return $st;
+
 }
 
 sub utf8_safe {
@@ -106,6 +123,15 @@
 code. This option enforces the middleware to display stack trace even
 if it's not the direct error thrown by the application.
 
+=item no_print_errors
+
+  enable "StackTrace", no_print_errors => 1;
+
+Skips printing the text stacktrace to console
+(C<psgi.errors>). Defaults to 0, which means the text version of the
+stack trace error is printed to the errors handle, which usually is a
+standard error.
+
 =back
 
 =head1 AUTHOR

Modified: trunk/libplack-perl/lib/Plack/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Request.pm?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Request.pm (original)
+++ trunk/libplack-perl/lib/Plack/Request.pm Thu May  6 13:08:19 2010
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use 5.008_001;
-our $VERSION = '0.9934';
+our $VERSION = '0.9935';
 $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=57566&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Response.pm (original)
+++ trunk/libplack-perl/lib/Plack/Response.pm Thu May  6 13:08:19 2010
@@ -1,7 +1,7 @@
 package Plack::Response;
 use strict;
 use warnings;
-our $VERSION = '0.9934';
+our $VERSION = '0.9935';
 $VERSION = eval $VERSION;
 
 use Plack::Util::Accessor qw(body status);

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=57566&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm (original)
+++ trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm Thu May  6 13:08:19 2010
@@ -1,6 +1,6 @@
 package Plack::Server::ServerSimple;
 use strict;
-our $VERSION = '0.9934';
+our $VERSION = '0.9935';
 $VERSION = eval $VERSION;
 
 use parent qw(Plack::Handler::HTTP::Server::Simple);

Modified: trunk/libplack-perl/t/Plack-Handler/cgi.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Handler/cgi.t?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Handler/cgi.t (original)
+++ trunk/libplack-perl/t/Plack-Handler/cgi.t Thu May  6 13:08:19 2010
@@ -20,6 +20,7 @@
 
         my $cgi = HTTP::Request::AsCGI->new($req);
         my $c = $cgi->setup;
+        $ENV{SCRIPT_NAME} = '/plack_test.cgi';
         eval { Plack::Handler::CGI->new->run($handler) };
         my $res = $c->response;
         $res->request($req);

Modified: trunk/libplack-perl/t/Plack-Middleware/order.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Middleware/order.t?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Middleware/order.t (original)
+++ trunk/libplack-perl/t/Plack-Middleware/order.t Thu May  6 13:08:19 2010
@@ -10,7 +10,8 @@
     };
 };
 
-my $res = $handler->(+{});
+open my $io, ">", \my $err;
+my $res = $handler->({ 'psgi.errors' => $io });
 is $res->[0], 500;
 
 my %hdrs = @{$res->[1]};

Modified: trunk/libplack-perl/t/Plack-Middleware/prefix.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Middleware/prefix.t?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Middleware/prefix.t (original)
+++ trunk/libplack-perl/t/Plack-Middleware/prefix.t Thu May  6 13:08:19 2010
@@ -10,7 +10,8 @@
     };
 };
 
-my $res = $handler->(+{});
+open my $io, ">", \my $err;
+my $res = $handler->({ 'psgi.errors' => $io });
 is $res->[0], 500;
 
 my %hdrs = @{$res->[1]};

Modified: trunk/libplack-perl/t/Plack-Middleware/stacktrace.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Middleware/stacktrace.t?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Middleware/stacktrace.t (original)
+++ trunk/libplack-perl/t/Plack-Middleware/stacktrace.t Thu May  6 13:08:19 2010
@@ -5,7 +5,7 @@
 use Plack::Test;
 use HTTP::Request::Common;
 
-my $app = Plack::Middleware::StackTrace->wrap(sub { die "orz" });
+my $app = Plack::Middleware::StackTrace->wrap(sub { die "orz" }, no_print_errors => 1);
 
 test_psgi $app, sub {
     my $cb = shift;

Modified: trunk/libplack-perl/t/Plack-Middleware/stacktrace_force.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Middleware/stacktrace_force.t?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Middleware/stacktrace_force.t (original)
+++ trunk/libplack-perl/t/Plack-Middleware/stacktrace_force.t Thu May  6 13:08:19 2010
@@ -11,7 +11,7 @@
     return [ 500, [ 'Content-Type', 'text/html' ], [ "Fancy Error" ] ];
 };
 
-my $default_app = Plack::Middleware::StackTrace->wrap($app);
+my $default_app = Plack::Middleware::StackTrace->wrap($app, no_print_errors => 1);
 
 test_psgi $default_app, sub {
     my $cb = shift;
@@ -23,7 +23,7 @@
     like $res->content, qr/Fancy Error/;
 };
 
-my $force_app = Plack::Middleware::StackTrace->wrap($app, force => 1);
+my $force_app = Plack::Middleware::StackTrace->wrap($app, force => 1, no_print_errors => 1);
 
 test_psgi $force_app, sub {
     my $cb = shift;

Modified: trunk/libplack-perl/t/Plack-Middleware/stacktrace_utf8.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Middleware/stacktrace_utf8.t?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Middleware/stacktrace_utf8.t (original)
+++ trunk/libplack-perl/t/Plack-Middleware/stacktrace_utf8.t Thu May  6 13:08:19 2010
@@ -7,7 +7,7 @@
 use HTTP::Request::Common;
 
 $Plack::Test::Impl = "Server";
-my $app = Plack::Middleware::StackTrace->wrap(sub { die "Foo \x{30c6}" });
+my $app = Plack::Middleware::StackTrace->wrap(sub { die "Foo \x{30c6}" }, no_print_errors => 1);
 
 test_psgi $app, sub {
     my $cb = shift;

Modified: trunk/libplack-perl/t/Plack-Server/compat.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Server/compat.t?rev=57566&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Server/compat.t (original)
+++ trunk/libplack-perl/t/Plack-Server/compat.t Thu May  6 13:08:19 2010
@@ -14,6 +14,7 @@
 my $req = HTTP::Request->new(GET => "http://localhost/foo");
 my $cgi = HTTP::Request::AsCGI->new($req);
 my $c = $cgi->setup;
+$ENV{SCRIPT_NAME} = '/plack_test.cgi';
 
 my $stderr;
 {




More information about the Pkg-perl-cvs-commits mailing list