/usr/share/perl5/Flickr/API/People.pm is in libflickr-api-perl 1.28-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | package Flickr::API::People;
use strict;
use warnings;
use Carp;
use parent qw( Flickr::API );
our $VERSION = '1.28';
sub _initialize {
my $self=shift;
my $check;
#if $self->api_permissions . . .
my $rsp = $self->execute_method('flickr.auth.oauth.checkToken');
if (!$rsp->success()) {
$rsp->_propagate_status($self->{flickr}->{status});
carp "\nUnable to validate token. Flickr error: ",
$self->{flickr}->{status}->{error_code}," - \"",
$self->{flickr}->{status}->{error_message},"\" \n";
$self->_set_status(0,"Unable to validate token, Flickr API call not successful.");
}
else {
$check = $rsp->as_hash();
$self->{flickr}->{token} = $check->{oauth};
$self->_set_status(1,"Token validated.");
}
return;
}
sub findByEmail {
my $self = shift;
my $email = shift;
$self->clear_user;
unless ($email) { croak 'Usage: $api->findByEmail("an-email-address")'; }
my $rsp = $self->execute_method('flickr.people.findByEmail',{'find_email' => $email});
$rsp->_propagate_status($self->{flickr}->{status});
if ($rsp->success == 1) {
my $eresult = $rsp->as_hash();
$self->_set_status(1,"flickr.people.findByEmail successfully found " . $email);
$self->{flickr}->{user} = $eresult->{user};
}
else {
$self->_set_status(0,"Unable to find user with: " . $email);
}
return $self->username;
}
sub findByUsername {
my $self = shift;
my $user = shift;
$self->clear_user;
unless ($user) { croak 'Usage: $api->findByUsername("a_user_name")'; }
my $rsp = $self->execute_method('flickr.people.findByUsername',{'username' => $user});
$rsp->_propagate_status($self->{flickr}->{status});
if ($rsp->success == 1) {
my $uresult = $rsp->as_hash();
$self->_set_status(1,"flickr.people.findByUsername successfully found " . $user);
$self->{flickr}->{user} = $uresult->{user};
}
else {
$self->_set_status(0,"Unable to find user with: " . $user);
}
return $self->username;
}
sub perms {
my $self=shift;
return $self->{flickr}->{token}->{perms};
}
sub perms_caller {
my $self=shift;
return $self->{flickr}->{token}->{user}->{username};
}
sub perms_nsid {
my $self=shift;
return $self->{flickr}->{token}->{user}->{nsid};
}
sub perms_token {
my $self=shift;
return $self->{flickr}->{token}->{token};
}
sub nsid {
my $self=shift;
return $self->{flickr}->{user}->{nsid};
}
sub username {
my $self=shift;
return $self->{flickr}->{user}->{username};
}
sub user {
my $self=shift;
return $self->{flickr}->{user};
}
sub clear_user {
my $self=shift;
delete $self->{flickr}->{user};
return;
}
1;
__END__
=head1 NAME
Flickr::API::People - Perl interface to the Flickr API's flickr.people.* methods.
=head1 SYNOPSIS
use Flickr::API::People;
my $api = Flickr::API::People->new({'consumer_key' => 'your_api_key'});
or
my $api = Flickr::API::People->import_storable_config($config_file);
=head1 DESCRIPTION
This object encapsulates the flickr people methods.
C<Flickr::API::People> is a subclass of L<Flickr::API>, so you can access
Flickr's people information easily.
=head1 SUBROUTINES/METHODS
=over
=item C<findByEmail()>
Populates user info with that found for the given email
=item C<findByUsername()>
Populates user info with that found for the given username
=item C<perms()>
Returns the permission returned by checking this supplied token
=item C<perms_caller>
Returns the username for which the permission applies
=item C<perms_token>
Returns the token for which the permission applies
=item C<perms_nsid>
Returns the nsid for which the permission applies
=item C<nsid()>
Returns the nsid of the supplied mail or username
=item C<username()>
Returns the username of the supplied mail or username
=back
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2015-2016, Louis B. Moore
This program is released under the Artistic License 2.0 by The Perl Foundation.
Original version was Copyright (C) 2005 Nuno Nunes, C<< <nfmnunes@cpan.org> >>
This version is much changed and built on the Flickr::API as it appears in
2015. Many thanks to Nuno Nunes for getting this ball rolling.
=head1 SEE ALSO
L<Flickr::API>.
L<Flickr|http://www.flickr.com/>,
L<http://www.flickr.com/services/api/>
L<https://github.com/iamcal/perl-Flickr-API>
=cut
|