Dave Rolsky > URI-FromHash-0.03 > URI::FromHash



Annotate this POD


Open  0
View/Report Bugs
Module Version: 0.03   Source   Latest Release: URI-FromHash-0.05


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


  use URI::FromHash qw( uri );

  my $uri = uri( path  => '/some/path',
                 query => { foo => 1, bar => 2 },


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.


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:


Dave Rolsky, <autarch@urth.org>


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.


Copyright 2006-2008 Dave Rolsky, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: