The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

URI::PathAbstract - A URI-like object with Path::Abstract capabilities

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 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->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 *

See URI for more information

scheme

fragment

as_string

canonical

eq

authority

query

query_form

query_keywords

userinfo

host

port

host_port

default_port

abs

Returns a URI::PathAbstract object

rel

Returns a URI::PathAbstract object

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

Path::Abstract

Path::Resource

AUTHOR

Robert Krimen, <rkrimen at cpan.org>

SOURCE

You can contribute or fork this project via GitHub:

http://github.com/robertkrimen/path-abstract/tree/master

    git clone git://github.com/robertkrimen/path-abstract.git Path-Abstract