line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::OAuth::Request; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
3805
|
use URI; |
|
5
|
|
|
|
|
17418
|
|
|
5
|
|
|
|
|
161
|
|
4
|
5
|
|
|
5
|
|
26
|
use WWW::OAuth::Util 'form_urldecode'; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
262
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
22
|
use Role::Tiny; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
29
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires 'method', 'url', 'content', 'content_is_form', 'header', 'request_with'; |
11
|
|
|
|
|
|
|
|
12
|
8
|
|
|
8
|
1
|
569
|
sub query_pairs { [map { utf8::decode $_; $_ } URI->new(shift->url)->query_form] } |
|
30
|
|
|
|
|
880
|
|
|
30
|
|
|
|
|
98
|
|
13
|
|
|
|
|
|
|
|
14
|
6
|
|
|
6
|
1
|
24517
|
sub body_pairs { form_urldecode shift->content } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
1; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
WWW::OAuth::Request - HTTP Request container role |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use Role::Tiny::With; |
25
|
|
|
|
|
|
|
with 'WWW::OAuth::Request'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
L is a L role that provides a consistent |
30
|
|
|
|
|
|
|
interface to L for parsing and authenticating requests. See |
31
|
|
|
|
|
|
|
L for specifics. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
L implements or requires the following methods. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 body_pairs |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $pairs = $req->body_pairs; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Return body parameters from C L"content"> |
42
|
|
|
|
|
|
|
as an even-sized arrayref of keys and values. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 content |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $content = $req->content; |
47
|
|
|
|
|
|
|
$req = $req->content('foo=1&baz=2'); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Set or return request content. Must be implemented to compose role. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 content_is_form |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $bool = $req->content_is_form; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Check whether content is single-part and content type is |
56
|
|
|
|
|
|
|
C. Must be implemented to compose role. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 header |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $header = $req->header('Content-Type'); |
61
|
|
|
|
|
|
|
$req = $req->header('Content-Type' => 'application/x-www-form-urlencoded'); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Set or return a request header. Multiple values can be set by passing an array |
64
|
|
|
|
|
|
|
reference as the value, and multi-value headers are joined on C<, > when |
65
|
|
|
|
|
|
|
returned. Must be implemented to compose role. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 method |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $method = $req->method; |
70
|
|
|
|
|
|
|
$req = $req->method('GET'); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Set or return request method. Must be implemented to compose role. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 query_pairs |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $pairs = $req->query_pairs; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Return query parameters from L"url"> as an even-sized arrayref of keys and |
79
|
|
|
|
|
|
|
values. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 request_with |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
my $res = $req->request_with($ua); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Send request using passed user-agent object, and return response. Must be |
86
|
|
|
|
|
|
|
implemented to compose role. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 url |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my $url = $req->url; |
91
|
|
|
|
|
|
|
$req = $req->url('http://example.com/api/'); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Set or return request URL. Must be implemented to compose role. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 BUGS |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Report any issues on the public bugtracker. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Dan Book |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by Dan Book. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This is free software, licensed under: |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SEE ALSO |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L, L |