Skip to content

Commit

Permalink
a few more path examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 14, 2014
1 parent 6712502 commit 3b90f8d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/Mojo/Path.pm
Expand Up @@ -207,6 +207,12 @@ Check if path contains given prefix.
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);
# "foo/bar"
$path->parse('/foo/bar')->leading_slash(0);
=head2 merge
$path = $path->merge('/foo/bar');
Expand Down Expand Up @@ -301,6 +307,12 @@ Turn path into a string.
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);
# "/foo/bar"
$path->parse('/foo/bar/')->trailing_slash(0);
=head1 OPERATORS
L<Mojo::Path> overloads the following operators.
Expand Down
3 changes: 3 additions & 0 deletions lib/Mojo/URL.pm
Expand Up @@ -344,6 +344,9 @@ Parse relative or absolute URL.
Path part of this URL, relative paths will be merged with the existing path,
defaults to a L<Mojo::Path> object.
# "perldoc"
Mojo::URL->new('http://example.com/perldoc/Mojo')->path->parts->[0];
# "http://example.com/DOM/HTML"
Mojo::URL->new('http://example.com/perldoc/Mojo')->path('/DOM/HTML');
Expand Down

0 comments on commit 3b90f8d

Please sign in to comment.