line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Flickr::API2::Request; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
20
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
117
|
|
4
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
81
|
|
5
|
4
|
|
|
4
|
|
1816
|
use HTTP::Request; |
|
4
|
|
|
|
|
65130
|
|
|
4
|
|
|
|
|
120
|
|
6
|
4
|
|
|
4
|
|
30
|
use URI; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
93
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
1683
|
use parent qw(HTTP::Request); |
|
4
|
|
|
|
|
573
|
|
|
4
|
|
|
|
|
25
|
|
9
|
|
|
|
|
|
|
our $VERSION = '2.00'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
10
|
|
|
10
|
1
|
17
|
my $class = shift; |
13
|
10
|
|
|
|
|
65
|
my $options = shift; |
14
|
10
|
|
|
|
|
93
|
my $self = new HTTP::Request; |
15
|
10
|
|
|
|
|
559
|
$self->{api_method} = $options->{method}; |
16
|
10
|
|
|
|
|
63
|
$self->{api_args} = $options->{args}; |
17
|
10
|
|
50
|
|
|
38
|
$self->{rest_uri} = $options->{rest_uri} |
18
|
|
|
|
|
|
|
|| 'http://api.flickr.com/services/rest/'; |
19
|
|
|
|
|
|
|
|
20
|
10
|
|
|
|
|
26
|
bless $self, $class; |
21
|
|
|
|
|
|
|
|
22
|
10
|
|
|
|
|
39
|
$self->{api_args}->{format} = 'json'; |
23
|
10
|
|
|
|
|
22
|
$self->{api_args}->{nojsoncallback} = 1; |
24
|
|
|
|
|
|
|
|
25
|
10
|
|
|
|
|
41
|
$self->method('POST'); |
26
|
10
|
|
|
|
|
115
|
$self->uri( $self->{rest_uri} ); |
27
|
|
|
|
|
|
|
|
28
|
10
|
|
|
|
|
3163
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub encode_args { |
32
|
10
|
|
|
10
|
1
|
17
|
my ($self) = @_; |
33
|
|
|
|
|
|
|
|
34
|
10
|
|
|
|
|
33
|
my $url = URI->new('http:'); |
35
|
10
|
|
|
|
|
409
|
$url->query_form( %{ $self->{api_args} } ); |
|
10
|
|
|
|
|
97
|
|
36
|
10
|
|
|
|
|
1776
|
my $content = $url->query; |
37
|
|
|
|
|
|
|
|
38
|
10
|
|
|
|
|
155
|
$self->header( 'Content-Type' => 'application/x-www-form-urlencoded' ); |
39
|
10
|
50
|
|
|
|
545
|
if ( defined($content) ) { |
40
|
10
|
|
|
|
|
39
|
$self->header( 'Content-Length' => length($content) ); |
41
|
10
|
|
|
|
|
437
|
$self->content($content); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |