c632c13503d537995163b22783686f7bd6bb5fa6
[liburi-template-perl.git] / README
1 NAME
2     URI::Template - Object for handling URI templates
3
4 SYNOPSIS
5         use URI::Template;
6         my $template = URI::Template->new( 'http://example.com/{x}' );
7         my $uri      = $template->process( x => 'y' );
8         # uri is a URI object with value 'http://example.com/y'
9
10         my %result = $template->deparse( $uri );
11         # %result is ( x => 'y' )
12
13 DESCRIPTION
14     This is an initial attempt to provide a wrapper around URI templates as
15     described at
16     http://www.ietf.org/internet-drafts/draft-gregorio-uritemplate-01.txt
17
18 INSTALLATION
19         perl Makefile.PL
20         make
21         make test
22         make install
23
24 METHODS
25   new( $template )
26     Creates a new URI::Template instance with the template passed in as the
27     first parameter.
28
29   as_string( )
30     Returns the original template string. Also used when the object is
31     stringified.
32
33   variables( )
34     Returns an array of unique variable names found in the template. NB:
35     they are returned in random order.
36
37   all_variables( )
38     Returns an array of variable names found as they appear in template --
39     in order, duplicates included.
40
41   process( %vars|\@values )
42     Given a list of key-value pairs or an array ref of values (for
43     positional substitution), it will URI escape the values and substitute
44     them in to the template. Returns a URI object.
45
46   process_to_string( %vars|\@values )
47     Processes input like the "process" method, but doesn't inflate the
48     result to a URI object.
49
50   deparse( $uri )
51     Does some rudimentary deparsing of a uri based on the current template.
52     Returns a hash with the extracted values.
53
54 AUTHOR
55     Brian Cassidy <bricas@cpan.org>
56
57 COPYRIGHT AND LICENSE
58     Copyright 2008 by Brian Cassidy
59
60     This library is free software; you can redistribute it and/or modify it
61     under the same terms as Perl itself.
62