This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update HTTP-Tiny to CPAN version 0.016
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Thu, 27 Oct 2011 21:45:21 +0000 (22:45 +0100)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Thu, 27 Oct 2011 22:38:17 +0000 (23:38 +0100)
  [DELTA]

  0.016     2011-10-26 23:05:50 America/New_York

  [BUG FIXES]

  - Fixed Perl 5.6 compatibility by emulating utf8::encode [David Golden]

Porting/Maintainers.pl
cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
pod/perldelta.pod

index f2a3724..bd95837 100755 (executable)
@@ -978,7 +978,7 @@ use File::Glob qw(:case);
     'HTTP::Tiny' =>
        {
        'MAINTAINER'    => 'dagolden',
-       'DISTRIBUTION'  => 'DAGOLDEN/HTTP-Tiny-0.015.tar.gz',
+       'DISTRIBUTION'  => 'DAGOLDEN/HTTP-Tiny-0.016.tar.gz',
        'FILES'         => q[cpan/HTTP-Tiny],
        'EXCLUDED'      => [
                                't/200_live.t',
index f0ed572..c9a2dca 100644 (file)
@@ -3,7 +3,7 @@ package HTTP::Tiny;
 use strict;
 use warnings;
 # ABSTRACT: A small, simple, correct HTTP/1.1 client
-our $VERSION = '0.015'; # VERSION
+our $VERSION = '0.016'; # VERSION
 
 use Carp ();
 
@@ -355,13 +355,21 @@ sub _parse_http_date {
 
 # URI escaping adapted from URI::Escape
 # c.f. http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
+# perl 5.6 ready UTF-8 encoding adapted from JSON::PP
 my %escapes = map { chr($_) => sprintf("%%%02X", $_) } 0..255;
 $escapes{' '}="+";
 my $unsafe_char = qr/[^A-Za-z0-9\-\._~]/;
 
 sub _uri_escape {
     my ($self, $str) = @_;
-    utf8::encode($str);
+    if ( $] ge '5.008' ) {
+        utf8::encode($str);
+    }
+    else {
+        $str = pack("U*", unpack("C*", $str)) # UTF-8 encode a byte string
+            if ( length $str == do { use bytes; length $str } );
+        $str = pack("C*", unpack("C*", $str)); # clear UTF-8 flag
+    }
     $str =~ s/($unsafe_char)/$escapes{$1}/ge;
     return $str;
 }
@@ -832,7 +840,7 @@ HTTP::Tiny - A small, simple, correct HTTP/1.1 client
 
 =head1 VERSION
 
-version 0.015
+version 0.016
 
 =head1 SYNOPSIS
 
index 8f6a0e9..d59b546 100644 (file)
@@ -104,7 +104,7 @@ L<ExtUtils::MakeMaker> has been upgraded from version 6.61_01 to version 6.63_01
 
 =item *
 
-L<HTTP::Tiny> has been upgraded from version 0.013 to version 0.015.
+L<HTTP::Tiny> has been upgraded from version 0.013 to version 0.016.
 
 Adds additional shorthand methods for all common HTTP verbs,
 a C<post_form()> method for POST-ing x-www-form-urlencoded data and