diff options
author | Julien Fiegehenn <simbabque@cpan.org> | 2023-04-29 14:41:17 +0100 |
---|---|---|
committer | Olaf Alders <olaf@wundersolutions.com> | 2023-04-29 15:58:40 +0200 |
commit | 85253786118786f88c52ffcf3fbf34c3e721d953 (patch) | |
tree | 6859c8986a0f7a7fae23e5155715f113a45cb8e4 /lib/URI.pm | |
parent | 44ebc98e09bfdda797b52940d7ee941c97e406b5 (diff) | |
download | uri-85253786118786f88c52ffcf3fbf34c3e721d953.tar.gz |
rephrase POD and add test to prove it
Diffstat (limited to 'lib/URI.pm')
-rw-r--r-- | lib/URI.pm | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -57,7 +57,7 @@ sub new $uri = defined ($uri) ? "$uri" : ""; # stringify # Get rid of potential wrapping - $uri =~ s/^<(?:URL:)?(.*)>$/$1/; # + $uri =~ s/^<(?:URL:)?(.*)>$/$1/; # $uri =~ s/^"(.*)"$/$1/; $uri =~ s/^\s+//; $uri =~ s/\s+$//; @@ -230,7 +230,7 @@ sub _scheme Carp::croak("Bad scheme '$new'") unless $new =~ /^$scheme_re$/o; $old = $1 if $$self =~ s/^($scheme_re)://o; my $newself = URI->new("$new:$$self"); - $$self = $$newself; + $$self = $$newself; bless $self, ref($newself); } else { @@ -876,7 +876,7 @@ every case where it has been used. Sets and returns the unescaped hostname. -If the $new_host string ends with a colon and a number, then this +If the C<$new_host> string ends with a colon and a number, then this number also sets the port. For IPv6 addresses the brackets around the raw address is removed in the return @@ -884,14 +884,17 @@ value from $uri->host. When setting the host attribute to an IPv6 address you can use a raw address or one enclosed in brackets. The address needs to be enclosed in brackets if you want to pass in a new port value as well. -Sample: Returns I<www.xn--ri-sample-fra0f> for I<http://www.E<0xC3>E<0xBC>ri-sample/foo/bar.html> + my $uri = URI->new("http://www.\xC3\xBCri-sample/foo/bar.html"); + print $u->host; # www.xn--ri-sample-fra0f + =item $uri->ihost Returns the host in Unicode form. Any IDNA A-labels (encoded unicode chars with I<xn--> prefix) are turned into U-labels (unicode chars). -Sample: Returns I<www.E<0xC3>E<0xBC>ri-sample> for I<http://www.E<0xC3>E<0xBC>ri-sample/foo/bar.html> + my $uri = URI->new("http://www.\xC3\xBCri-sample/foo/bar.html"); + print $u->ihost; # www.\xC3\xBCri-sample =item $uri->port |