NAME

PlackX::Framework::URIx - Extended URI class.

DESCRIPTION

PlackX::Framework::URIx is part of PlackX::Framework. This module is a subclass of URI::Fast with extra features for manipulating query strings, namely setting, adding, or deleting parameters; and creating absolute URLs from relative ones.

Rationale

While it is true the URI module does offer URI::QueryParam which can add similar features, that module was designed to replicate the CGI.pm interface. This one does not. Method names are shorter and have been chosen to avoid conflicting with the methods offered by URI::QueryParam. The other distinguishing characteristic is that all of the added methods return the object so that method calls may be chained.

Methods

The following methods are those in addition to the ones contained in the URI::Fast module.

merge($rel_uri)

Merge a URI with a relative URI, e.g. with a URIx object of http://www.somewhere.com/fruit/apple and a $rel_uri of '../vegetable/carrot', returns http://www.somewhere.com/vegetable/carrot.

merge_with_query($rel_uri)

Same as merge(), but preserves the query string.

query_set(@pairs)

Adds the list of key-value pairs to the query string. If any keys already exist, they are removed, even if they key appears more than once in the existing query. If you would like to preserve existing queys, use query_add instead. The list must be key-values pairs; no references are accepted.

query_add(@pairs)

Adds the list of key-value pairs to the query string, even if the respective keys already exist.

query_delete(@keys)

Deletes any parameters in the query string named by the list.

query_delete_all

Deletes all parameters from the query string.

query_delete_all_except(@keys)

Deletes all parameters from the query string except for the ones named by the list.

query_delete_keys_starting_with($string)

query_delete_keys_ending_with($string)

Deletes any parameters in the query string that start or end (respectively) with the string $string.

query_delete_keys_matching($pattern)

query_delete_all_except_keys_matching($pattern)

Deletes any parameters in the query string that match or don't match (respectively) the pattern contained in $pattern.

EXPORTS

None.

SEE ALSO

URI::Fast
URI
URI::QueryParam
Rose::URI