line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Flickr::API2::Request; |
2
|
4
|
|
|
4
|
|
33
|
use 5.12.0; |
|
4
|
|
|
|
|
8
|
|
3
|
4
|
|
|
4
|
|
12
|
use warnings; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
75
|
|
4
|
4
|
|
|
4
|
|
824
|
use HTTP::Request; |
|
4
|
|
|
|
|
31948
|
|
|
4
|
|
|
|
|
91
|
|
5
|
4
|
|
|
4
|
|
17
|
use URI; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
70
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
812
|
use parent qw(HTTP::Request); |
|
4
|
|
|
|
|
408
|
|
|
4
|
|
|
|
|
19
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.00'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
10
|
|
|
10
|
1
|
21
|
my $class = shift; |
12
|
10
|
|
|
|
|
13
|
my $options = shift; |
13
|
10
|
|
|
|
|
76
|
my $self = new HTTP::Request; |
14
|
10
|
|
|
|
|
485
|
$self->{api_method} = $options->{method}; |
15
|
10
|
|
|
|
|
18
|
$self->{api_args} = $options->{args}; |
16
|
|
|
|
|
|
|
$self->{rest_uri} = $options->{rest_uri} |
17
|
10
|
|
50
|
|
|
35
|
|| 'http://api.flickr.com/services/rest/'; |
18
|
|
|
|
|
|
|
|
19
|
10
|
|
|
|
|
18
|
bless $self, $class; |
20
|
|
|
|
|
|
|
|
21
|
10
|
|
|
|
|
21
|
$self->{api_args}->{format} = 'json'; |
22
|
10
|
|
|
|
|
20
|
$self->{api_args}->{nojsoncallback} = 1; |
23
|
|
|
|
|
|
|
|
24
|
10
|
|
|
|
|
28
|
$self->method('POST'); |
25
|
10
|
|
|
|
|
78
|
$self->uri( $self->{rest_uri} ); |
26
|
|
|
|
|
|
|
|
27
|
10
|
|
|
|
|
2110
|
return $self; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub encode_args { |
31
|
10
|
|
|
10
|
1
|
14
|
my ($self) = @_; |
32
|
|
|
|
|
|
|
|
33
|
10
|
|
|
|
|
31
|
my $url = URI->new('http:'); |
34
|
10
|
|
|
|
|
414
|
$url->query_form( %{ $self->{api_args} } ); |
|
10
|
|
|
|
|
75
|
|
35
|
10
|
|
|
|
|
1485
|
my $content = $url->query; |
36
|
|
|
|
|
|
|
|
37
|
10
|
|
|
|
|
128
|
$self->header( 'Content-Type' => 'application/x-www-form-urlencoded' ); |
38
|
10
|
50
|
|
|
|
449
|
if ( defined($content) ) { |
39
|
10
|
|
|
|
|
34
|
$self->header( 'Content-Length' => length($content) ); |
40
|
10
|
|
|
|
|
312
|
$self->content($content); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |