| 1 |
NAME |
| 2 |
URI::Template - Object for handling URI templates (RFC 6570) |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use URI::Template; |
| 6 |
|
| 7 |
my $template = URI::Template->new( 'http://example.com/{x}' ); |
| 8 |
my $uri = $template->process( x => 'y' ); |
| 9 |
|
| 10 |
# or |
| 11 |
|
| 12 |
my $template = URI::Template->new(); |
| 13 |
$template->template( 'http://example.com/{x}' ); |
| 14 |
my $uri = $template->process( x => 'y' ); |
| 15 |
|
| 16 |
# uri is a URI object with value 'http://example.com/y' |
| 17 |
|
| 18 |
or |
| 19 |
|
| 20 |
use URI::Template ':template_process' |
| 21 |
|
| 22 |
my $uri = template_process ( 'http://example.com/{x}', x => 'y' ); |
| 23 |
|
| 24 |
DESCRIPTION |
| 25 |
This module provides a wrapper around URI templates as described in RFC |
| 26 |
6570: <http://tools.ietf.org/html/rfc6570>. |
| 27 |
|
| 28 |
INSTALLATION |
| 29 |
perl Makefile.PL |
| 30 |
make |
| 31 |
make test |
| 32 |
make install |
| 33 |
|
| 34 |
METHODS |
| 35 |
new( $template ) |
| 36 |
Creates a new URI::Template instance with the template passed in as the |
| 37 |
first parameter (optional). |
| 38 |
|
| 39 |
template( $template ) |
| 40 |
This method returns the original template string. If provided, it will |
| 41 |
also set and parse a new template string. |
| 42 |
|
| 43 |
variables |
| 44 |
Returns an array of unique variable names found in the template (in the |
| 45 |
order of appearance). |
| 46 |
|
| 47 |
expansions |
| 48 |
This method returns an list of expansions found in the template. |
| 49 |
Currently, these are just coderefs. In the future, they will be more |
| 50 |
interesting. |
| 51 |
|
| 52 |
process( \%vars ) |
| 53 |
Given a list of key-value pairs or an array ref of values (for |
| 54 |
positional substitution), it will URI escape the values and substitute |
| 55 |
them in to the template. Returns a URI object. |
| 56 |
|
| 57 |
process_to_string( \%vars ) |
| 58 |
Processes input like the "process" method, but doesn't inflate the |
| 59 |
result to a URI object. |
| 60 |
|
| 61 |
EXPORTED FUNCTIONS |
| 62 |
template_process( $template => \%vars ) |
| 63 |
This is the same as "URI::Template->new($template)->process(\%vars)" But |
| 64 |
shorter, and usefull for quick and easy genrating a nice URI form |
| 65 |
parameters. |
| 66 |
|
| 67 |
Returns an URI object |
| 68 |
|
| 69 |
template_process_as_string( $template => \%vars ) |
| 70 |
Same as above, but obviously, returns a string. |
| 71 |
|
| 72 |
AUTHORS |
| 73 |
* Brian Cassidy <[email protected]> |
| 74 |
|
| 75 |
* Ricardo SIGNES <[email protected]> |
| 76 |
|
| 77 |
CONTRIBUTERS |
| 78 |
* Theo van Hoesel <[email protected]> |
| 79 |
|
| 80 |
COPYRIGHT AND LICENSE |
| 81 |
Copyright 2007-2018 by Brian Cassidy |
| 82 |
|
| 83 |
This library is free software; you can redistribute it and/or modify it |
| 84 |
under the same terms as Perl itself. |
| 85 |
|