Mojo::Path::Role::Relative - Relative operations on a Mojo::Path
$path = Mojo::Path->with_roles('+Relative')->new('/foo/bar/baz/data.json'); $base = Mojo::Path->new('/foo/bar'); # 1 $path->is_subpath_of($base); # "baz/data.json" $path->to_subpath_of($base); # "baz/data.json" $path->to_rel($base);
"to_rel" in Mojo::URL was deprecated sometime ago. A suggestion was made to move the functionality to Mojo::Path. This is an implementation of that suggestion as a role.
This role adds the following methods to Mojo::Path when composed.
kiwiroy - Roy Storey <kiwiroy@cpan.org>
This library is free software and may be distributed under the same terms as perl itself.
To install Mojo::Path::Role::Relative, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Path::Role::Relative
CPAN shell
perl -MCPAN -e shell install Mojo::Path::Role::Relative
For more information on module installation, please visit the detailed CPAN module installation guide.