File: README.md

package info (click to toggle)
liburi-fromhash-perl 0.05-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 248 kB
  • ctags: 4
  • sloc: perl: 369; makefile: 2
file content (110 lines) | stat: -rw-r--r-- 3,112 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
NAME

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

VERSION

    version 0.05

SYNOPSIS

      use URI::FromHash qw( uri );
    
      my $uri = uri(
          path  => '/some/path',
          query => { foo => 1, bar => 2 },
      );

DESCRIPTION

    This module provides a simple one-subroutine "named parameters" style
    interface for creating URIs. Underneath the hood it uses URI.pm, though
    because of the simplified interface it may not support all possible
    options for all types of URIs.

    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
    URI.pm interface is rather tedious, requiring a number of method calls,
    which is particularly ugly when done inside a templating system such as
    Mason or TT2.

FUNCTIONS

    This module provides two functions both of which are optionally
    exportable:

 uri( ... ) and uri_object( ... )

    Both of these functions accept the same set of parameters, except for
    one additional parameter allowed when calling uri().

    The uri() function simply returns a string representing a canonicalized
    URI based on the provided parameters. The uri_object() function returns
    new a URI.pm object based on the given parameters.

    These parameters are:

      * scheme

      The URI's scheme. This is optional, and if none is given you will
      create a schemeless URI. This is useful if you want to create a URI
      to a path on the same server (as is commonly done in <a> tags).

      * host

      * port

      * path

      The path can be either a string or an array reference.

      If an array reference is passed each defined member of the array will
      be joined by a single forward slash (/).

      If you are building a host-less URI and want to include a leading
      slash then make the first element of the array reference an empty
      string (q{}).

      You can add a trailing slash by making the last element of the array
      reference an empty string.

      * username

      * password

      * fragment

      All of these are optional strings which can be used to specify that
      part of the URI.

      * query

      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.

      * query_separator

      This option is can only be provided when calling uri(). By default,
      it is a semi-colon (;).

BUGS

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

AUTHOR

    Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

    This software is Copyright (c) 2015 by Dave Rolsky.

    This is free software, licensed under:

      The Artistic License 2.0 (GPL Compatible)