r60216 - in /branches/upstream/libplack-perl/current: ./ lib/ lib/Plack/ lib/Plack/Middleware/ lib/Plack/Server/ t/Plack-Middleware/ t/Plack-Util/

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sun Jul 11 19:12:05 UTC 2010


Author: gregoa
Date: Sun Jul 11 19:11:55 2010
New Revision: 60216

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=60216
Log:
[svn-upgrade] new version libplack-perl (0.9941)

Added:
    branches/upstream/libplack-perl/current/t/Plack-Middleware/lint_utf8_false_alarm.t
    branches/upstream/libplack-perl/current/t/Plack-Util/inline_object.t
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/lib/Plack.pm
    branches/upstream/libplack-perl/current/lib/Plack/Middleware/Lint.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/Server/ServerSimple.pm

Modified: branches/upstream/libplack-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/Changes?rev=60216&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/Changes (original)
+++ branches/upstream/libplack-perl/current/Changes Sun Jul 11 19:11:55 2010
@@ -1,6 +1,9 @@
 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.9941  Thu Jul  8 18:17:30 PDT 2010
+        - Makes Lint not warn about ASCII-only strings with UTF8 flag because they're safe
 
 0.9940  Fri Jul  2 23:37:51 PDT 2010
         - Fixed META.yml

Modified: branches/upstream/libplack-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/MANIFEST?rev=60216&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/MANIFEST (original)
+++ branches/upstream/libplack-perl/current/MANIFEST Sun Jul 11 19:11:55 2010
@@ -181,6 +181,7 @@
 t/Plack-Middleware/httpexceptions_streaming.t
 t/Plack-Middleware/jsonp.t
 t/Plack-Middleware/lint.t
+t/Plack-Middleware/lint_utf8_false_alarm.t
 t/Plack-Middleware/log4perl.t
 t/Plack-Middleware/log_dispatch.t
 t/Plack-Middleware/method_override.t
@@ -257,6 +258,7 @@
 t/Plack-Util/headers_obj.t
 t/Plack-Util/Hello.pm
 t/Plack-Util/hello.psgi
+t/Plack-Util/inline_object.t
 t/Plack-Util/io_with_path.t
 t/Plack-Util/is_real_fh.t
 t/Plack-Util/load.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=60216&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/META.yml (original)
+++ branches/upstream/libplack-perl/current/META.yml Sun Jul 11 19:11:55 2010
@@ -38,4 +38,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: git://github.com/miyagawa/Plack.git
-version: 0.9940
+version: 0.9941

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=60216&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack.pm Sun Jul 11 19:11:55 2010
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use 5.008_001;
-our $VERSION = '0.9940';
+our $VERSION = '0.9941';
 $VERSION = eval $VERSION;
 
 1;

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=60216&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware/Lint.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware/Lint.pm Sun Jul 11 19:11:55 2010
@@ -116,11 +116,19 @@
         $croak->('body should be an array ref or filehandle');
     }
 
-    if (ref $res->[2] eq 'ARRAY' && grep utf8::is_utf8($_), @{$res->[2]}) {
+    if (ref $res->[2] eq 'ARRAY' && grep _is_really_utf8($_), @{$res->[2]}) {
         $croak->('body must be bytes and should not contain wide characters (UTF-8 strings).');
     }
 
     return $res;
+}
+
+# NOTE: Some modules like HTML:: or XML:: could possibly generate
+# ASCII only strings with utf8 flags on. They're actually safe to
+# print, so there's no need to give warnings about it.
+sub _is_really_utf8 {
+    my $str = shift;
+    utf8::is_utf8($str) && $str =~ /[^\x00-\x7f]/;
 }
 
 1;

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=60216&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Request.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Request.pm Sun Jul 11 19:11:55 2010
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use 5.008_001;
-our $VERSION = '0.9940';
+our $VERSION = '0.9941';
 $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=60216&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Response.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Response.pm Sun Jul 11 19:11:55 2010
@@ -1,7 +1,7 @@
 package Plack::Response;
 use strict;
 use warnings;
-our $VERSION = '0.9940';
+our $VERSION = '0.9941';
 $VERSION = eval $VERSION;
 
 use Plack::Util::Accessor qw(body status);

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=60216&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm Sun Jul 11 19:11:55 2010
@@ -1,6 +1,6 @@
 package Plack::Server::ServerSimple;
 use strict;
-our $VERSION = '0.9940';
+our $VERSION = '0.9941';
 $VERSION = eval $VERSION;
 
 use parent qw(Plack::Handler::HTTP::Server::Simple);

Added: branches/upstream/libplack-perl/current/t/Plack-Middleware/lint_utf8_false_alarm.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Middleware/lint_utf8_false_alarm.t?rev=60216&op=file
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Middleware/lint_utf8_false_alarm.t (added)
+++ branches/upstream/libplack-perl/current/t/Plack-Middleware/lint_utf8_false_alarm.t Sun Jul 11 19:11:55 2010
@@ -1,0 +1,24 @@
+use strict;
+use Plack::Test;
+use Test::More;
+use HTTP::Request::Common;
+
+use Plack::Middleware::Lint;
+
+my @good = map { Plack::Middleware::Lint->wrap($_) } (
+    sub {
+        my $body = "abc";
+        utf8::upgrade($body);
+        return [ 200, [ "Content-Type", "text/plain;charset=utf-8"], [ $body ] ];
+    },
+);
+
+for my $app (@good) {
+    test_psgi $app, sub {
+        my $cb = shift;
+        my $res = $cb->(GET "/");
+        is $res->code, 200, $res->content;
+    };
+}
+
+done_testing;

Added: branches/upstream/libplack-perl/current/t/Plack-Util/inline_object.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Util/inline_object.t?rev=60216&op=file
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Util/inline_object.t (added)
+++ branches/upstream/libplack-perl/current/t/Plack-Util/inline_object.t Sun Jul 11 19:11:55 2010
@@ -1,0 +1,21 @@
+use Test::More;
+use Plack::Util;
+use Try::Tiny;
+
+my $counter;
+my $object = Plack::Util::inline_object(
+    method1 => sub { $counter++ },
+);
+
+$object->method1;
+is $counter, 1, 'method call works';
+
+my $sub = $object->can('method1');
+ok $sub, 'can returns true value for method';
+try { $sub->($object) };
+is $counter, 2, 'can returns sub ref for method';
+
+ok ! try { $object->method2; 1 }, 'croaks if nonexistant method called';
+is $object->can('method2'), undef, 'can returns undef for nonexistant method';
+
+done_testing;




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