NAME
URI::PathAbstract - A URI-like object with Path::Abstract capabilities
VERSION
Version 0.01
SYNOPSIS
my $uri = URI::PathAbstract->new("http://example.com?a=b")
$uri->down("apple")
# http://example.com/apple?a=b
$uri->query("c=d&e=f")
# http://example.com/apple?c=d&e=f
$uri->path("grape/blueberry/pineapple")
# http://example.com/grape/blueberry/pineapple?c=d&e=f
$uri = $uri->parent
# http://example.com/grape/blueberry?c=d&e=f
$uri = $uri->child("xyzzy")
# http://example.com/grape/blueberry/xyzzy?c=d&e=f
DESCRIPTION
URI::PathAbstract is a combination of the URI::WithBase and Path::Abstract classes. It is essentially a URI class that delegates path-handling methods to Path::Abstract
Unfortunately, this is not true:
URI::PathAbstract->new( http://example.com )->isa( URI )
URI::PathAbstract supports the URI generic and common methods
METHODS
URI::PathAbstract->new( <uri>, ... )
Create a new URI::PathAbstract object based on <uri>
<uri> should be of the URI class or some sort of URI-like string
URI::PathAbstract->new( <uri>, path => <path>, ... )
Create a new URI::PathAbstract object based on <uri> but overriding the path with <path>
URI::PathAbstract->new("http://example.com/cherry?a=b", path => "grape/lemon")
# http://example.com/grape/lemon?a=b"
URI::PathAbstract->new( <uri>, child => <child>, ... )
Create a new URI::PathAbstract object based on <uri> but modifying the path by <child>
URI::PathAbstract->new("http://example.com/cherry?a=b", child => "grape/lemon")
# http://example.com/cherry/grape/lemon?a=b"
URI::PathAbstract->new( ... )
Create a new URI::PathAbstract object based on the following:
uri The URI you want to represent
base A base URI for use with ->abs and ->rel
path A path that will override the path of the given uri
(although the scheme, host, ... will remain the same)
child A path that will be appended to the path of the given uri
$uri->uri
Returns a URI object that is a copy (not a reference) of the URI object inside $uri
$uri->path
Returns a Path::Abstract object that is a copy (not a reference) of the Path::Abstract object inside $uri
$uri->path( <path> )
Sets the path of $uri, completely overwriting what was there before
The rest of $uri (host, port, scheme, query, ...) does not change
$uri->clone
Returns a URI::PathAbstract that is an exact clone of $uri
$uri->base
Returns a URI::PathAbstract object that is a copy (not a reference) of the base for $uri
Returns undef if $uri does not have a base uri
$uri->base( <base> )
Sets the base of $uri to <base>
$uri->abs
$uri->abs( [ <base> ] )
Returns a URI::PathAbstract object that is the absolute URI formed by combining $uri and <base>
If <base> is not given, then $uri->base is used as the base
If <base> is not given and $uri->base does not exist, then a clone of $uri is returned
See URI and URI::WithBase for more abs
information
$uri->rel
$uri->rel( [ <base> ] )
Returns a URI::PathAbstract object that is the relative URI formed by comparing $uri and <base>
If <base> is not given, then $uri->base is used as the base
If <base> is not given and $uri->base does not exist, then a clone of $uri is returned
See URI and URI::WithBase for more rel
information
URI
See URI for more information
->scheme
->fragment
->as_string
->canonical
->eq
->authority
->query
->query_form
->query_keywords
->userinfo
->host
->port
->host_port
->default_port
->opaque
->path_query
->path_segments
Path::Abstract
See Path::Abstract for more information
->child
->parent
->up
->pop
->down
->push
->to_tree
->to_branch
->list
->first
->last
->is_empty
->is_nil
->is_root
->is_tree
->is_branch
SEE ALSO
AUTHOR
Robert Krimen, <rkrimen at cpan.org>
SOURCE
You can contribute or fork this project via GitHub:
http://github.com/robertkrimen/uri-pathabstract/tree/master
git clone git://github.com/robertkrimen/uri-pathabstract.git URI-PathAbstract
BUGS
Please report any bugs or feature requests to bug-uri-pathabstract at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=URI-PathAbstract. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc URI::PathAbstract
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2008 Robert Krimen, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.