Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
URI::FromHash(3)      User Contributed Perl Documentation     URI::FromHash(3)

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

       version 0.05

	 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	"",
       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
       ""	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

   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 "" object based on the given parameters.

       These parameters	are:

       o   scheme

	   The URI's scheme. This is optional, and if none is given you	will
	   create a schemeless URI. This is useful if you want to create a URI
	   to a	path on	the same server	(as is commonly	done in	"<a>" tags).

       o   host

       o   port

       o   path

	   The path can	be either a string or an array reference.

	   If an array reference is passed each	defined	member of the array
	   will	be joined by a single forward slash (/).

	   If you are building a host-less URI and want	to include a leading
	   slash then make the first element of	the array reference an empty
	   string ("q{}").

	   You can add a trailing slash	by making the last element of the
	   array reference an empty string.

       o   username

       o   password

       o   fragment

	   All of these	are optional strings which can be used to specify that
	   part	of the URI.

       o   query

	   This	should be a hash reference of query parameters.	The values for
	   each	key may	be a scalar or array reference.	Use an array reference
	   to provide multiple values for one key.

       o   query_separator

	   This	option is can only be provided when calling "uri()". By
	   default, it is a semi-colon (;).

       Please report any bugs or feature requests to
       "", or through the web interface at
       <>.  I	will be	notified, and then you'll
       automatically be	notified of progress on	your bug as I make changes.

       Dave Rolsky <>

       This software is	Copyright (c) 2015 by Dave Rolsky.

       This is free software, licensed under:

	 The Artistic License 2.0 (GPL Compatible)

perl v5.32.0			  2015-10-17		      URI::FromHash(3)


Want to link to this manual page? Use this URL:

home | help