Skip to content

Commit

Permalink
Import of GAAS/URI-1.35 from CPAN.
Browse files Browse the repository at this point in the history
gitpan-cpan-distribution: URI
gitpan-cpan-version:      1.35
gitpan-cpan-path:         GAAS/URI-1.35.tar.gz
gitpan-cpan-author:       GAAS
gitpan-cpan-maturity:     released
  • Loading branch information
gisle authored and Gitpan committed Oct 21, 2014
1 parent 70f04f3 commit 697b439
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
13 changes: 13 additions & 0 deletions Changes
@@ -1,3 +1,16 @@
2004-11-05 Gisle Aas <gisle@ActiveState.com>

Release 1.35

Documentation update.

Simplified uri_escape_utf8 implementation. No need to load the
Encode module. Contributed by Alexey Tourbin.

Work around bug in perl-5.6.0 that made t/query.t fail.



2004-10-05 Gisle Aas <gisle@ActiveState.com>

Release 1.34
Expand Down
6 changes: 5 additions & 1 deletion URI.pm
Expand Up @@ -2,7 +2,7 @@ package URI;

use strict;
use vars qw($VERSION);
$VERSION = "1.34"; # $Date: 2004/10/05 08:36:13 $
$VERSION = "1.35"; # $Date: 2004/11/05 14:17:33 $

use vars qw($ABS_REMOTE_LEADING_DOTS $ABS_ALLOW_RELATIVE_SCHEME);

Expand Down Expand Up @@ -570,6 +570,10 @@ parameter strings. Such an anonymous array uses overloading so it can
be treated as a string too, but this string does not include the
parameters.
Note that absolute paths have the empty string as their first
I<path_segment>, i.e. the I<path> C</foo/bar> have 3
I<path_segments>; "", "foo" and "bar".
=item $uri->query
=item $uri->query( $new_query )
Expand Down
20 changes: 14 additions & 6 deletions URI/Escape.pm
@@ -1,5 +1,5 @@
#
# $Id: Escape.pm,v 3.26 2004/04/13 15:17:27 gisle Exp $
# $Id: Escape.pm,v 3.28 2004/11/05 13:58:31 gisle Exp $
#

package URI::Escape;
Expand Down Expand Up @@ -92,6 +92,13 @@ will be the same as:
but will even work for perl-5.6 for chars in the 128 .. 255 range.
Note: Javascript has a function called escape() that produce the
sequence "%uXXXX" for chars in the 256 .. 65535 range. This function
has really nothing to do with URI escaping but some folks got confused
since it "does the right thing" in the 0 .. 255 range. Because of
this you sometimes see "URIs" with these kind of escapes. The
JavaScript encodeURI() function is similar to uri_escape_utf8().
=item uri_unescape($string,...)
Returns a string with each %XX sequence replaced with the actual byte
Expand Down Expand Up @@ -142,7 +149,7 @@ require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(uri_escape uri_unescape);
@EXPORT_OK = qw(%escapes uri_escape_utf8);
$VERSION = sprintf("%d.%02d", q$Revision: 3.26 $ =~ /(\d+)\.(\d+)/);
$VERSION = sprintf("%d.%02d", q$Revision: 3.28 $ =~ /(\d+)\.(\d+)/);

use Carp ();

Expand Down Expand Up @@ -179,14 +186,15 @@ sub _fail_hi {

sub uri_escape_utf8
{
my $text = shift;
if ($] < 5.008) {
my $text = shift;
$text =~ s/([^\0-\x7F])/do {my $o = ord($1); sprintf("%c%c", 0xc0 | ($o >> 6), 0x80 | ($o & 0x3f)) }/ge;
return uri_escape($text, @_);
}
else {
utf8::encode($text);
}

require Encode;
return uri_escape(Encode::encode_utf8(shift), @_);
return uri_escape($text, @_);
}

sub uri_unescape
Expand Down
4 changes: 2 additions & 2 deletions t/escape.t
Expand Up @@ -33,8 +33,8 @@ print "not " unless uri_escape_utf8("|abc
print "ok 7\n";

if ($] < 5.008) {
print "ok 8 # skipped\n";
print "ok 9 # skipped\n";
print "ok 8 # skip perl-5.8 required\n";
print "ok 9 # skip perl-5.8 required\n";
}
else {
eval { print uri_escape("abc" . chr(300)) };
Expand Down
2 changes: 1 addition & 1 deletion t/query.t
Expand Up @@ -77,7 +77,7 @@ print "not " unless $u eq "";
print "ok 17\n";

$u->query_form(a => { foo => 1 });
print "not " unless $u =~ /^\?a=HASH\(/;
print "not " unless "$u" =~ /^\?a=HASH\(/;
print "ok 18\n";

__END__
Expand Down

0 comments on commit 697b439

Please sign in to comment.