Imported upstream version 0.08.01
[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     To install this module via Module::Build:
20
21             perl Build.PL
22             ./Build         # or `perl Build`
23             ./Build test    # or `perl Build test`
24             ./Build install # or `perl Build install`
25
26     To install this module via ExtUtils::MakeMaker:
27
28             perl Makefile.PL
29             make
30             make test
31             make install
32
33 METHODS
34   new( $template )
35     Creates a new URI::Template instance with the template passed in as the
36     first parameter.
37
38   as_string( )
39     Returns the original template string. Also used when the object is
40     stringified.
41
42   variables( )
43     Returns an array of variable names found in the template. NB: they are
44     returned in random order.
45
46   all_variables( )
47     Returns an array of variable names found as they appear in template --
48     in order, duplicates included.
49
50   process( %vars|\@values )
51     Given a list of key-value pairs or an array ref of values (for
52     positional substitution), it will URI escape the values and substitute
53     them in to the template. Returns a URI object.
54
55   process_to_string( %vars|\@values )
56     Processes input like the "process" method, but doesn't inflate the
57     result to a URI object.
58
59   deparse( $uri )
60     Does some rudimentary deparsing of a uri based on the current template.
61     Returns a hash with the extracted values.
62
63 AUTHOR
64     * Brian Cassidy <bricas@cpan.org>
65
66 COPYRIGHT AND LICENSE
67     Copyright 2007 by Brian Cassidy
68
69     This library is free software; you can redistribute it and/or modify it
70     under the same terms as Perl itself.
71