URI::Template - Object for handling URI templates


URI-Template documentation  | view source Contained in the URI-Template distribution.

Index


NAME

Top

URI::Template - Object for handling URI templates

SYNOPSIS

Top

    use URI::Template;
    my $template = URI::Template->new( 'http://example.com/{x}' );
    my $uri      = $template->process( x => 'y' );
    # uri is a URI object with value 'http://example.com/y'

DESCRIPTION

Top

This is an initial attempt to provide a wrapper around URI templates as described at http://www.ietf.org/internet-drafts/draft-gregorio-uritemplate-03.txt

INSTALLATION

Top

    perl Makefile.PL
    make
    make test
    make install

METHODS

Top

new( $template )

Creates a new URI::Template instance with the template passed in as the first parameter.

template

This method returns the original template string.

variables

Returns an array of unique variable names found in the template. NB: they are returned in random order.

expansions

This method returns an list of expansions found in the template. Currently, these are just coderefs. In the future, they will be more interesting.

process( \%vars )

Given a list of key-value pairs or an array ref of values (for positional substitution), it will URI escape the values and substitute them in to the template. Returns a URI object.

process_to_string( \%vars )

Processes input like the process method, but doesn't inflate the result to a URI object.

AUTHOR

Top

Brian Cassidy <bricas@cpan.org>

Ricardo SIGNES <rjbs@cpan.org>

COPYRIGHT AND LICENSE

Top


URI-Template documentation  | view source Contained in the URI-Template distribution.