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

FreeBSD Manual Pages

  
 
  

home | help
WWW::OAuth::Util(3)   User Contributed Perl Documentation  WWW::OAuth::Util(3)

NAME
       WWW::OAuth::Util	- Utility functions for	WWW::OAuth

SYNOPSIS
	use WWW::OAuth::Util 'form_urldecode', 'form_urlencode';
	my $body_string	= form_urlencode({foo => 'a b c', bar => [1, 2,	3]});
	# bar=1&bar=2&bar=3&foo=a+b+c
	my $ordered_pairs = form_urldecode($body_string);
	# ['bar', '1', 'bar', '2', 'bar', '3', 'foo', 'a b c']

	use WWW::OAuth::Util 'oauth_request';
	my $container =	oauth_request($http_request);

DESCRIPTION
       WWW::OAuth::Util	contains utility functions for use with	WWW::OAuth.
       All functions are exportable on demand.

FUNCTIONS
   form_urldecode
	my $param_pairs	= form_urldecode($body_string);

       Decodes an "application/x-www-form-urlencoded" string and returns an
       even-sized arrayref of key-value	pairs. Order is	preserved and repeated
       keys are	not combined.

   form_urlencode
	my $body_string	= form_urlencode([foo => 2, bar	=> 'baz', foo => 1]);
	# foo=2&bar=baz&foo=1
	my $body_string	= form_urlencode({foo => [2, 1], bar =>	'baz'});
	# bar=baz&foo=2&foo=1

       Converts	a hash or array	reference into an
       "application/x-www-form-urlencoded" string suitable for a query string
       or request body.	If a value is an array reference, the key is repeated
       with each value.	Order is preserved if parameters are passed in an
       array reference;	the parameters are sorted by key for consistency if
       passed in a hash	reference.

   oauth_request
	my $container =	oauth_request($http_request);
	my $container =	oauth_request({	method => 'GET', url =>	$url });
	my $container =	oauth_request(Basic => { method	=> 'POST', url => $url,	content	=> $content });

       Constructs an HTTP request container performing the WWW::OAuth::Request
       role. The input should be a recognized request object or	hashref	of
       arguments optionally preceded by	a container class name.	The class name
       is appended to "WWW::OAuth::Request::" if it does not contain "::".
       Currently, HTTP::Request	and Mojo::Message::Request objects are
       recognized, and hashrefs	are used to construct a
       WWW::OAuth::Request::Basic object if no container class is specified.

	# Longer forms to construct WWW::OAuth::Request::HTTP_Request
	my $container =	oauth_request(HTTP_Request => $http_request);
	my $container =	oauth_request(HTTP_Request => {	request	=> $http_request });

BUGS
       Report any issues on the	public bugtracker.

AUTHOR
       Dan Book	<dbook@cpan.org>

COPYRIGHT AND LICENSE
       This software is	Copyright (c) 2015 by Dan Book.

       This is free software, licensed under:

	 The Artistic License 2.0 (GPL Compatible)

SEE ALSO
       URI, URL	Living Standard	<https://url.spec.whatwg.org/#application/x-
       www-form-urlencoded>

perl v5.32.1			  2018-09-17		   WWW::OAuth::Util(3)

NAME | SYNOPSIS | DESCRIPTION | FUNCTIONS | BUGS | AUTHOR | COPYRIGHT AND LICENSE | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=WWW::OAuth::Util&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help