| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::Geograph::Response; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict ; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
76
|
|
|
4
|
2
|
|
|
2
|
|
20
|
use warnings ; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
63
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use Data::Dumper ; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
81
|
|
|
7
|
2
|
|
|
2
|
|
1835
|
use HTTP::Response ; |
|
|
2
|
|
|
|
|
18688
|
|
|
|
2
|
|
|
|
|
521
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(HTTP::Response) ; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.05' ; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
WebService::Geograph::Response - A response object from Geograph API |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use WebService::Geograph::API; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $api = new WebService::Geograph::API ( { 'key' => 'your_api_key_here'} ) ; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $rv = $api->lookup ( 'csv', { 'i' => 12345, |
|
24
|
|
|
|
|
|
|
'll' => 1, |
|
25
|
|
|
|
|
|
|
'thumb' => 1, |
|
26
|
|
|
|
|
|
|
}) ; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $data = $rd->{results} ; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This object encapsulates a single response as returned from the API. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
The C object is essentially a subclass of C so you can |
|
35
|
|
|
|
|
|
|
actually edit its usual parameters as much as you want. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
It also has a number of additional keys. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
{ |
|
40
|
|
|
|
|
|
|
sucess => 1 or 0 |
|
41
|
|
|
|
|
|
|
error_code => contains the error code (if any) |
|
42
|
|
|
|
|
|
|
error_message => contains the error message (if any) |
|
43
|
|
|
|
|
|
|
results => will always contain the data |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 AUTHOR |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Spiros Denaxas |
|
52
|
|
|
|
|
|
|
CPAN ID: SDEN |
|
53
|
|
|
|
|
|
|
Lokku Ltd ( http://www.nestoria.co.uk ) |
|
54
|
|
|
|
|
|
|
s [dot] denaxas [@] gmail [dot]com |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This program is free software; you can redistribute |
|
59
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
62
|
|
|
|
|
|
|
LICENSE file included with this module. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L, L, L, L |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub new { |
|
73
|
0
|
|
|
0
|
1
|
|
my $class = shift ; |
|
74
|
0
|
|
|
|
|
|
my $self = new HTTP::Response ; |
|
75
|
0
|
|
|
|
|
|
my $options = shift ; |
|
76
|
0
|
|
|
|
|
|
bless $self, $class ; |
|
77
|
0
|
|
|
|
|
|
return $self ; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub init_stats { |
|
82
|
0
|
|
|
0
|
0
|
|
my $self = shift ; |
|
83
|
0
|
|
|
|
|
|
$self->{results} = undef ; |
|
84
|
0
|
|
|
|
|
|
$self->{success} = 0 ; |
|
85
|
0
|
|
|
|
|
|
$self->{error_code} = 0 ; |
|
86
|
0
|
|
|
|
|
|
$self->{error_message} = 0 ; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub set_fail { |
|
90
|
0
|
|
|
0
|
0
|
|
my ($self, $code, $message) = (@_) ; |
|
91
|
0
|
|
|
|
|
|
$self->{success} = 0 ; |
|
92
|
0
|
|
|
|
|
|
$self->{error_code} = $code ; |
|
93
|
0
|
|
|
|
|
|
$self->{error_message} = $message ; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub set_success { |
|
97
|
0
|
|
|
0
|
0
|
|
my ($self, $data) = (@_) ; |
|
98
|
0
|
|
|
|
|
|
$self->{success} = 1 ; |
|
99
|
0
|
|
|
|
|
|
$self->{results} = $data ; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1 ; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
'ERROR: no api key or email address' |