line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Flickr::API::People; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22182
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
94
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
726
|
use parent qw( Flickr::API ); |
|
1
|
|
|
|
|
321
|
|
|
1
|
|
|
|
|
6
|
|
9
|
|
|
|
|
|
|
our $VERSION = '1.26'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _initialize { |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $self=shift; |
15
|
|
|
|
|
|
|
my $check; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $rsp = $self->execute_method('flickr.auth.oauth.checkToken'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
if (!$rsp->success()) { |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$rsp->_propagate_status($self->{flickr}->{status}); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
carp "\nUnable to validate token. Flickr error: ", |
25
|
|
|
|
|
|
|
$self->{flickr}->{status}->{error_code}," - \"", |
26
|
|
|
|
|
|
|
$self->{flickr}->{status}->{error_message},"\" \n"; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$self->_set_status(0,"Unable to validate token, Flickr API call not successful."); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$check = $rsp->as_hash(); |
34
|
|
|
|
|
|
|
$self->{flickr}->{token} = $check->{oauth}; |
35
|
|
|
|
|
|
|
$self->_set_status(1,"Token validated."); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
return; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub findByEmail { |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $self = shift; |
46
|
|
|
|
|
|
|
my $email = shift; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $rsp = $self->execute_method('flickr.people.findByEmail',{'find_email' => $email}); |
49
|
|
|
|
|
|
|
$rsp->_propagate_status($self->{flickr}->{status}); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
if ($rsp->success == 1) { |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $eresult = $rsp->as_hash(); |
54
|
|
|
|
|
|
|
$self->_set_status(1,"flickr.people.findByEmail successfully found " . $email); |
55
|
|
|
|
|
|
|
$self->{flickr}->{user} = $eresult->{user}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
else { |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$self->_set_status(0,"Unable to find user with: " . $email); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
return; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub findByUsername { |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $self = shift; |
70
|
|
|
|
|
|
|
my $user = shift; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my $rsp = $self->execute_method('flickr.people.findByUsername',{'username' => $user}); |
73
|
|
|
|
|
|
|
$rsp->_propagate_status($self->{flickr}->{status}); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
if ($rsp->success == 1) { |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $uresult = $rsp->as_hash(); |
78
|
|
|
|
|
|
|
$self->_set_status(1,"flickr.people.findByUsername successfully found " . $user); |
79
|
|
|
|
|
|
|
$self->{flickr}->{user} = $uresult->{user}; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
else { |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
$self->_set_status(0,"Unable to find user with: " . $user); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
return; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub perms { |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $self=shift; |
95
|
|
|
|
|
|
|
return $self->{flickr}->{token}->{perms}; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub nsid { |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my $self=shift; |
102
|
|
|
|
|
|
|
return $self->{flickr}->{user}->{nsid}; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub username { |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
my $self=shift; |
109
|
|
|
|
|
|
|
return $self->{flickr}->{user}->{username}; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub user { |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
my $self=shift; |
116
|
|
|
|
|
|
|
return $self->{flickr}->{user}; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__END__ |