Permalink
Browse files

Drop support for Perl < 5.8.1

    Perl 5.8 was released almost 10 years ago. It's time.
  • Loading branch information...
1 parent 5e14caf commit fec082d6f9e814e06830a6a3e0dd5345736f5d73 @markstos markstos committed Dec 18, 2010
Showing with 11 additions and 26 deletions.
  1. +1 −1 Makefile.PL
  2. +1 −1 README
  3. +4 −16 URI/Escape.pm
  4. +1 −2 URI/_punycode.pm
  5. +4 −6 t/escape.t
View
@@ -1,4 +1,4 @@
-require 5.006001;
+require 5.008001;
use ExtUtils::MakeMaker;
if ("foo" !~ /\Afoo\z/) {
View
2 README
@@ -10,7 +10,7 @@ combine URIs in various ways.
Some tests require an Internet connection to work and are skipped if
one is not active.
-You need perl-5.6.1 or better to install this package. You should also
+You need perl-5.8.1 or better to install this package. You should also
have the MIME::Base64 module installed. Installation is otherwise as
usual:
View
@@ -80,16 +80,10 @@ range will be escaped differently by this function compared to what
uri_escape() would. For chars in the 0 .. 127 range there is no
difference.
-The call:
+Equivalent to:
- $uri = uri_escape_utf8($string);
-
-will be the same as:
-
- use Encode qw(encode);
- $uri = uri_escape(encode("UTF-8", $string));
-
-but will even work for perl-5.6 for chars in the 128 .. 255 range.
+ utf8::encode($string);
+ my $uri = uri_escape($string);
Note: JavaScript has a function called escape() that produces the
sequence "%uXXXX" for chars in the 256 .. 65535 range. This function
@@ -186,13 +180,7 @@ sub _fail_hi {
sub uri_escape_utf8 {
my $text = shift;
- if ($] < 5.008) {
- $text =~ s/([^\0-\x7F])/do {my $o = ord($1); sprintf("%c%c", 0xc0 | ($o >> 6), 0x80 | ($o & 0x3f)) }/ge;
- }
- else {
- utf8::encode($text);
- }
-
+ utf8::encode($text);
return uri_escape($text, @_);
}
View
@@ -91,8 +91,7 @@ sub decode_punycode {
sub encode_punycode {
my $input = shift;
- # my @input = split //, $input; # doesn't work in 5.6.x!
- my @input = map substr($input, $_, 1), 0..length($input)-1;
+ my @input = split //, $input;
my $n = INITIAL_N;
my $delta = 0;
View
@@ -31,11 +31,9 @@ use URI::Escape qw(uri_escape_utf8);
is uri_escape_utf8("|abcå"), "%7Cabc%C3%A5";
-SKIP: {
- skip "Perl 5.8.0 or higher required", 3 if $] < 5.008;
+skip "Perl 5.8.0 or higher required", 3 if $] < 5.008;
- ok !eval { print uri_escape("abc" . chr(300)); 1 };
- like $@, qr/^Can\'t escape \\x{012C}, try uri_escape_utf8\(\) instead/;
+ok !eval { print uri_escape("abc" . chr(300)); 1 };
+like $@, qr/^Can\'t escape \\x{012C}, try uri_escape_utf8\(\) instead/;
- is uri_escape_utf8(chr(0xFFF)), "%E0%BF%BF";
-}
+is uri_escape_utf8(chr(0xFFF)), "%E0%BF%BF";

0 comments on commit fec082d

Please sign in to comment.