~ubuntu-branches/ubuntu/saucy/liburi-perl/saucy

« back to all changes in this revision

Viewing changes to URI.pm

  • Committer: Package Import Robot
  • Author(s): Angel Abad, Ansgar Burchardt, Salvatore Bonaccorso, Angel Abad
  • Date: 2011-08-17 18:06:15 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20110817180615-zd1vbl9ovnw0cf1e
Tags: 1.59-1
[ Ansgar Burchardt ]
* debian/control: Convert Vcs-* fields to Git.

[ Salvatore Bonaccorso ]
* [packagecheck] fixed Vcs-(Git|Browser)/Homepage field(s) in
  debian/control and/or URL in debian/watch and/or rmdir
  /usr/{lib|share}/perl5 in debian/rules.

[ Angel Abad ]
* Imported Upstream version 1.59
* Bump Standards-Version to 3.9.2 (no changes)
* debian/copyright: Update years
* Bump debhelper compatibility level to 8

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
use strict;
4
4
use vars qw($VERSION);
5
 
$VERSION = "1.58";
 
5
$VERSION = "1.59";
6
6
 
7
7
use vars qw($ABS_REMOTE_LEADING_DOTS $ABS_ALLOW_RELATIVE_SCHEME $DEFAULT_QUERY_FORM_DELIMITER);
8
8
 
90
90
{
91
91
    my($class, $str) = @_;
92
92
    $str =~ s*([^$uric\#])* URI::Escape::escape_char($1) *ego;
 
93
    utf8::downgrade($str);
93
94
    return $str;
94
95
}
95
96
 
218
219
    my $new_opaque = shift;
219
220
    $new_opaque = "" unless defined $new_opaque;
220
221
    $new_opaque =~ s/([^$uric])/ URI::Escape::escape_char($1)/ego;
 
222
    utf8::downgrade($new_opaque);
221
223
 
222
224
    $$self = defined($old_scheme) ? $old_scheme : "";
223
225
    $$self .= $new_opaque;
243
245
    my $new_frag = shift;
244
246
    if (defined $new_frag) {
245
247
        $new_frag =~ s/([^$uric])/ URI::Escape::escape_char($1) /ego;
 
248
        utf8::downgrade($new_frag);
246
249
        $$self .= "#$new_frag";
247
250
    }
248
251
    $old;
470
473
returning the old value of the component.  Passing an undefined
471
474
argument removes the component (if possible).  The description of
472
475
each accessor method indicates whether the component is passed as
473
 
an escaped or an unescaped string.  A component that can be further
 
476
an escaped (percent-encoded) or an unescaped string.  A component that can be further
474
477
divided into sub-parts are usually passed escaped, as unescaping might
475
478
change its semantics.
476
479
 
1050
1053
 
1051
1054
=head1 BUGS
1052
1055
 
1053
 
Using regexp variables like $1 directly as arguments to the URI methods
 
1056
There are some things that are not quite right:
 
1057
 
 
1058
=over
 
1059
 
 
1060
=item *
 
1061
 
 
1062
Using regexp variables like $1 directly as arguments to the URI accessor methods
1054
1063
does not work too well with current perl implementations.  I would argue
1055
1064
that this is actually a bug in perl.  The workaround is to quote
1056
1065
them. Example:
1058
1067
   /(...)/ || die;
1059
1068
   $u->query("$1");
1060
1069
 
 
1070
 
 
1071
=item *
 
1072
 
 
1073
The escaping (percent encoding) of chars in the 128 .. 255 range passed to the
 
1074
URI constructor or when setting URI parts using the accessor methods depend on
 
1075
the state of the internal UTF8 flag (see utf8::is_utf8) of the string passed.
 
1076
If the UTF8 flag is set the UTF-8 encoded version of the character is percent
 
1077
encoded.  If the UTF8 flag isn't set the Latin-1 version (byte) of the
 
1078
character is percent encoded.  This basically exposes the internal encoding of
 
1079
Perl strings.
 
1080
 
 
1081
=back
 
1082
 
1061
1083
=head1 PARSING URIs WITH REGEXP
1062
1084
 
1063
1085
As an alternative to this module, the following (official) regular