Skip to content

Commit

Permalink
a few more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 15, 2014
1 parent e485a94 commit 4fc0e1d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

5.70 2014-12-14
5.70 2014-12-15
- Improved Mojo::Template performance.

5.69 2014-12-13
Expand Down
3 changes: 3 additions & 0 deletions lib/Mojo/Parameters.pm
Expand Up @@ -269,6 +269,9 @@ array reference. Note that this method will normalize the parameters.
Merge L<Mojo::Parameters> objects. Note that this method will normalize the
parameters.
# "foo=bar&foo=baz"
Mojo::Parameters->new('foo=bar')->merge(Mojo::Parameters->new('foo=baz'));
=head2 new
my $params = Mojo::Parameters->new;
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojo/Path.pm
Expand Up @@ -208,10 +208,10 @@ Path has a leading slash. Note that this method will normalize the path and
that C<%2F> will be treated as C</> for security reasons.
# "/foo/bar"
$path->parse('foo/bar')->leading_slash(1);
Mojo::Path->new('foo/bar')->leading_slash(1);
# "foo/bar"
$path->parse('/foo/bar')->leading_slash(0);
Mojo::Path->new('/foo/bar')->leading_slash(0);
=head2 merge
Expand Down Expand Up @@ -308,10 +308,10 @@ Path has a trailing slash. Note that this method will normalize the path and
that C<%2F> will be treated as C</> for security reasons.
# "/foo/bar/"
$path->parse('/foo/bar')->trailing_slash(1);
Mojo::Path->new('/foo/bar')->trailing_slash(1);
# "/foo/bar"
$path->parse('/foo/bar/')->trailing_slash(0);
Mojo::Path->new('/foo/bar/')->trailing_slash(0);
=head1 OPERATORS
Expand Down
12 changes: 12 additions & 0 deletions lib/Mojo/URL.pm
Expand Up @@ -312,6 +312,15 @@ Host part of this URL in punycode format.
Check if URL is absolute.
# True
Mojo::URL->new('http://example.com')->is_abs;
Mojo::URL->new('http://example.com/test/index.html')->is_abs;
# False
Mojo::URL->new('test/index.html')->is_abs;
Mojo::URL->new('/test/index.html')->is_abs;
Mojo::URL->new('//example.com/test/index.html')->is_abs;
=head2 new
my $url = Mojo::URL->new;
Expand Down Expand Up @@ -362,6 +371,9 @@ defaults to a L<Mojo::Path> object.
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;
=head2 protocol
my $proto = $url->protocol;
Expand Down

0 comments on commit 4fc0e1d

Please sign in to comment.