.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "WWW::OAuth::Util 3pm" .TH WWW::OAuth::Util 3pm "2022-12-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" WWW::OAuth::Util \- Utility functions for WWW::OAuth .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 5 \& use WWW::OAuth::Util \*(Aqform_urldecode\*(Aq, \*(Aqform_urlencode\*(Aq; \& my $body_string = form_urlencode({foo => \*(Aqa b c\*(Aq, bar => [1, 2, 3]}); \& # bar=1&bar=2&bar=3&foo=a+b+c \& my $ordered_pairs = form_urldecode($body_string); \& # [\*(Aqbar\*(Aq, \*(Aq1\*(Aq, \*(Aqbar\*(Aq, \*(Aq2\*(Aq, \*(Aqbar\*(Aq, \*(Aq3\*(Aq, \*(Aqfoo\*(Aq, \*(Aqa b c\*(Aq] \& \& use WWW::OAuth::Util \*(Aqoauth_request\*(Aq; \& my $container = oauth_request($http_request); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" WWW::OAuth::Util contains utility functions for use with WWW::OAuth. All functions are exportable on demand. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "form_urldecode" .IX Subsection "form_urldecode" .Vb 1 \& my $param_pairs = form_urldecode($body_string); .Ve .PP Decodes an \f(CW\*(C`application/x\-www\-form\-urlencoded\*(C'\fR string and returns an even-sized arrayref of key-value pairs. Order is preserved and repeated keys are not combined. .SS "form_urlencode" .IX Subsection "form_urlencode" .Vb 4 \& my $body_string = form_urlencode([foo => 2, bar => \*(Aqbaz\*(Aq, foo => 1]); \& # foo=2&bar=baz&foo=1 \& my $body_string = form_urlencode({foo => [2, 1], bar => \*(Aqbaz\*(Aq}); \& # bar=baz&foo=2&foo=1 .Ve .PP Converts a hash or array reference into an \f(CW\*(C`application/x\-www\-form\-urlencoded\*(C'\fR 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. .SS "oauth_request" .IX Subsection "oauth_request" .Vb 3 \& my $container = oauth_request($http_request); \& my $container = oauth_request({ method => \*(AqGET\*(Aq, url => $url }); \& my $container = oauth_request(Basic => { method => \*(AqPOST\*(Aq, url => $url, content => $content }); .Ve .PP Constructs an \s-1HTTP\s0 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 \&\f(CW\*(C`WWW::OAuth::Request::\*(C'\fR if it does not contain \f(CW\*(C`::\*(C'\fR. 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. .PP .Vb 3 \& # 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 }); .Ve .SH "BUGS" .IX Header "BUGS" Report any issues on the public bugtracker. .SH "AUTHOR" .IX Header "AUTHOR" Dan Book .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2015 by Dan Book. .PP This is free software, licensed under: .PP .Vb 1 \& The Artistic License 2.0 (GPL Compatible) .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1URI\s0, \s-1URL\s0 Living Standard