Skip to content

Commit

Permalink
a few more Mojo::URL examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 29, 2014
1 parent 2c5d2d0 commit bdd3e3c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/Mojo/URL.pm
Expand Up @@ -287,6 +287,12 @@ following new ones.
Authority part of this URL.
# "root:%E2%99%A5@xn--n3h.net:8080"
Mojo::URL->new('http://root:♥@☃.net:8080/test')->authority;
# "root@example.com"
Mojo::URL->new('http://root@example.com/test')->authority;
=head2 clone
my $url2 = $url->clone;
Expand All @@ -302,6 +308,9 @@ Normalized version of L</"host"> and L</"port">.
# "xn--n3h.net:8080"
Mojo::URL->new('http://☃.net:8080/test')->host_port;
# "example.com"
Mojo::URL->new('http://example.com/test')->host_port;
=head2 ihost
my $ihost = $url->ihost;
Expand All @@ -312,6 +321,9 @@ Host part of this URL in punycode format.
# "xn--n3h.net"
Mojo::URL->new('http://☃.net')->ihost;
# "example.com"
Mojo::URL->new('http://example.com')->ihost;
=head2 is_abs
my $bool = $url->is_abs;
Expand Down Expand Up @@ -380,6 +392,9 @@ Normalized version of L</"path"> and L</"query">.
# "/test?a=1&b=2"
Mojo::URL->new('http://example.com/test?a=1&b=2')->path_query;
# "/"
Mojo::URL->new('http://example.com/')->path_query;
=head2 protocol
my $proto = $url->protocol;
Expand Down

0 comments on commit bdd3e3c

Please sign in to comment.