Skip to content

Latest commit

 

History

History
112 lines (76 loc) · 1.62 KB

README.md

File metadata and controls

112 lines (76 loc) · 1.62 KB

TITLE

PostCocoon::Url

SUBTITLE

Some simple but useful URL utils

SYNOPSIS

A collection of functions that can be used for URL parsing, building and changing.

Also provides an loose URL tokenizer

sub url-encode

sub url-encode(
    Str $data
) returns Str

Transforms an string into an percent encoded string

sub url-decode

sub url-decode(
    Str $data
) returns Str

Transforms an percent encoded string into an plain string

sub build-query-string

sub build-query-string(
    Hash $hash
) returns Str

Build an query string from an Hash

sub build-query-string

sub build-query-string(
    *%hash
) returns Str

Build an query string from the named arguments

sub parse-query-string

sub parse-query-string(
    Str $query-string
) returns Hash

Parse a query string

class PostCocoon::Url::URL-Parser

Loose URL parser that doesn't follow RFC3986 not completly.

sub is-valid-url

sub is-valid-url(
    Str $uri
) returns Bool

Check if something is a valid url according to the parser

sub parse-url

sub parse-url(
    Str $uri
) returns Hash

Return an hash with all items of the url

sub build-url

sub build-url(
    Hash $hash
) returns Str

Build an url from given hash, this function does no error checking at all, it may result in an invalid url

sub build-url

sub build-url(
    *%hash
) returns Str

Build an url from given named parameters, this function does no error checking at all, it may result in an invalid url