.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "URI::FromHash 3pm" .TH URI::FromHash 3pm "2022-06-28" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" URI::FromHash \- Build a URI from a set of named parameters .SH "VERSION" .IX Header "VERSION" version 0.05 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use URI::FromHash qw( uri ); \& \& my $uri = uri( \& path => \*(Aq/some/path\*(Aq, \& query => { foo => 1, bar => 2 }, \& ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides a simple one-subroutine \*(L"named parameters\*(R" style interface for creating URIs. Underneath the hood it uses \f(CW\*(C`URI.pm\*(C'\fR, though because of the simplified interface it may not support all possible options for all types of URIs. .PP It was created for the common case where you simply want to have a simple interface for creating syntactically correct URIs from known components (like a path and query string). Doing this using the native \&\f(CW\*(C`URI.pm\*(C'\fR interface is rather tedious, requiring a number of method calls, which is particularly ugly when done inside a templating system such as Mason or \s-1TT2.\s0 .SH "FUNCTIONS" .IX Header "FUNCTIONS" This module provides two functions both of which are \fIoptionally\fR exportable: .SS "uri( ... ) and uri_object( ... )" .IX Subsection "uri( ... ) and uri_object( ... )" Both of these functions accept the same set of parameters, except for one additional parameter allowed when calling \f(CW\*(C`uri()\*(C'\fR. .PP The \f(CW\*(C`uri()\*(C'\fR function simply returns a string representing a canonicalized \s-1URI\s0 based on the provided parameters. The \&\f(CW\*(C`uri_object()\*(C'\fR function returns new a \f(CW\*(C`URI.pm\*(C'\fR object based on the given parameters. .PP These parameters are: .IP "\(bu" 4 scheme .Sp The \s-1URI\s0's scheme. This is optional, and if none is given you will create a schemeless \s-1URI.\s0 This is useful if you want to create a \s-1URI\s0 to a path on the same server (as is commonly done in \f(CW\*(C`\*(C'\fR tags). .IP "\(bu" 4 host .IP "\(bu" 4 port .IP "\(bu" 4 path .Sp The path can be either a string or an array reference. .Sp If an array reference is passed each \fIdefined\fR member of the array will be joined by a single forward slash (/). .Sp If you are building a host-less \s-1URI\s0 and want to include a leading slash then make the first element of the array reference an empty string (\f(CW\*(C`q{}\*(C'\fR). .Sp You can add a trailing slash by making the last element of the array reference an empty string. .IP "\(bu" 4 username .IP "\(bu" 4 password .IP "\(bu" 4 fragment .Sp All of these are optional strings which can be used to specify that part of the \s-1URI.\s0 .IP "\(bu" 4 query .Sp This should be a hash reference of query parameters. The values for each key may be a scalar or array reference. Use an array reference to provide multiple values for one key. .IP "\(bu" 4 query_separator .Sp This option is can \fIonly\fR be provided when calling \f(CW\*(C`uri()\*(C'\fR. By default, it is a semi-colon (;). .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \&\f(CW\*(C`bug\-uri\-fromhash@rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "AUTHOR" .IX Header "AUTHOR" Dave Rolsky .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2015 by Dave Rolsky. .PP This is free software, licensed under: .PP .Vb 1 \& The Artistic License 2.0 (GPL Compatible) .Ve