1URI::FromHash(3)      User Contributed Perl Documentation     URI::FromHash(3)
2
3
4

NAME

6       URI::FromHash - Build a URI from a set of named parameters
7

VERSION

9       version 0.05
10

SYNOPSIS

12         use URI::FromHash qw( uri );
13
14         my $uri = uri(
15             path  => '/some/path',
16             query => { foo => 1, bar => 2 },
17         );
18

DESCRIPTION

20       This module provides a simple one-subroutine "named parameters" style
21       interface for creating URIs. Underneath the hood it uses "URI.pm",
22       though because of the simplified interface it may not support all
23       possible options for all types of URIs.
24
25       It was created for the common case where you simply want to have a
26       simple interface for creating syntactically correct URIs from known
27       components (like a path and query string). Doing this using the native
28       "URI.pm" interface is rather tedious, requiring a number of method
29       calls, which is particularly ugly when done inside a templating system
30       such as Mason or TT2.
31

FUNCTIONS

33       This module provides two functions both of which are optionally
34       exportable:
35
36   uri( ... ) and uri_object( ... )
37       Both of these functions accept the same set of parameters, except for
38       one additional parameter allowed when calling "uri()".
39
40       The "uri()" function simply returns a string representing a
41       canonicalized URI based on the provided parameters. The "uri_object()"
42       function returns new a "URI.pm" object based on the given parameters.
43
44       These parameters are:
45
46       ·   scheme
47
48           The URI's scheme. This is optional, and if none is given you will
49           create a schemeless URI. This is useful if you want to create a URI
50           to a path on the same server (as is commonly done in "<a>" tags).
51
52       ·   host
53
54       ·   port
55
56       ·   path
57
58           The path can be either a string or an array reference.
59
60           If an array reference is passed each defined member of the array
61           will be joined by a single forward slash (/).
62
63           If you are building a host-less URI and want to include a leading
64           slash then make the first element of the array reference an empty
65           string ("q{}").
66
67           You can add a trailing slash by making the last element of the
68           array reference an empty string.
69
70       ·   username
71
72       ·   password
73
74       ·   fragment
75
76           All of these are optional strings which can be used to specify that
77           part of the URI.
78
79       ·   query
80
81           This should be a hash reference of query parameters. The values for
82           each key may be a scalar or array reference. Use an array reference
83           to provide multiple values for one key.
84
85       ·   query_separator
86
87           This option is can only be provided when calling "uri()". By
88           default, it is a semi-colon (;).
89

BUGS

91       Please report any bugs or feature requests to
92       "bug-uri-fromhash@rt.cpan.org", or through the web interface at
93       <http://rt.cpan.org>.  I will be notified, and then you'll
94       automatically be notified of progress on your bug as I make changes.
95

AUTHOR

97       Dave Rolsky <autarch@urth.org>
98
100       This software is Copyright (c) 2015 by Dave Rolsky.
101
102       This is free software, licensed under:
103
104         The Artistic License 2.0 (GPL Compatible)
105
106
107
108perl v5.28.0                      2015-10-17                  URI::FromHash(3)
Impressum