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