NAME
Flickr::Person - Represents a person of Flickr.
VERSION
Version 0.02
SYNOPSIS
use Flickr::Person;
my $flickrperson = Flickr::Person->new($flickr_api_key);
my $found_person = $flickrperson->find({email => 'john.doe@somewhere.net'});
if ($found_person) {
my $username = $flickrperson->username;
my $userid = $flickrperson->id;
my $usernsid = $flickrperson->nsid;
my $real_name = $flickrperson->real_name;
my $photos_uplodaded = $flickrperson->photo_count;
}
DESCRIPTION
This class represents a person on Flickr. It uses the Flickr::API::People class (and other's it finds necessary) in order to retrieve and send information to/from Flickr regarding a single person.
The class tries to be well behaved and Flickr-server-friendly by using lazy data fetching and caching techniques.
The methods that are available are read/write when the item is alterable via the Flickr API. What that means is that if you call a method with an argument it will set that value while if you call it without any arguments it will give you the current value.
Nevertheless do read on the descriptions of each method for more information on it's usage.
IMPORTANT NOTE: So far the above statement about the methods being read/write is wishfull thinking as I've only implemented the read funcionality. Write is coming soon.
METHODS
new
Sets up the structure for usage.
$person = Flickr::Person->new({api_key => $my_flickr_api_key, email => $my_flickr_email, password => $my_flickr_password});
The 'my_flickr_email' and 'my_flickr_password' are optional. See the method 'authenticate' for further explanation.
authenticate
Some interactions with flickr do require an authenticated user and some information is only accessible in this way and for those calls to be successfull you must provide these parameters. For everything else you really don't need them.
This method provides a way for the user to authenticate on all future calls.
This authentication data may also be provided via the new method.
$person->authenticate({ email => $my_flickr_email, password => $my_flickr_password});
find
Finds a person on Flickr and gets the basic information on her.
$found_person = $person->find({email => 'john.doe@somewhere.net'});
OR
$found_person = $person->find({username => 'JaneDoe'});
There are basically two ways to find a person on Flickr: by email or by username. Depending on what information you have you can choose to use one of the two calls above to do it.
Assuming the person is found, the object will then hole some basic information on the person. As you later try to access more information the object will do it's best to fetch the required information in real time and present it to you.
Please note that this method resets the object. If you already have information stored about the same or some other user inthis object, calling this method will throw all that information out and start anew.
username
Returns the username of the user.
$username = $p->username;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
id
This method has two distinct behaviours depending on whether you call it with or without a parameter.
If you call it without any params it just gives you back the ID of the person it is currently representing (assuming there is one person being represented at this time).
$id = $p->id;
On the other hand, if you call it with a parameter it assumes you wish to represent the person whose ID you just passed in and resets itself accordingly, deleting any data it might have had from a previous person, and gets the basic information on the person you requested.
$ok = $p->id({id => $person_id});
Always returns undef on error. Also on error the $p->{error} structure will be defined.
nsid
Returns the nsid of the person.
$nsid = $p->nsid;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
real_name
Returns the name of the person.
$real_name = $p->real_name;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
is_admin
Indicates if this person is an admin.
$is_admin = $p->is_admin;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
is_pro
Indicates if this person is a pro user (has a paid account) on Flickr.
$is_pro = $p->is_pro;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
location
Indicates the geographycal location of the person.
$location = $p->location;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
icon_server
Indicates the server which hols the icon for this person (see Buddyicons documentation on Flickr <http://flickr.com/services/api>).
$icon_server = $p->icon_server;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
photo_firstdate_posted
Returns the date that the person uploaded the first photo to Flickr.
$photo_firstdate_posted = $p->photo_firstdate_posted;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
photo_firstdate_taken
Returns the date on which the earliest photo by the person.
$photo_firstdate_taken = $p->photo_firstdate_taken;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
photo_count
Returns the number of photos this user has posted to Flickr.
$photo_count = $p->photo_count;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
photosets
Returns an array of Flickr::Photoset objects representing the photosets this user has on Flickr.
$photosets = $p->photosets;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
photos
NOTICE: This function is not yet implemented! Disregard this documentation for now.
$photos = $p->photos;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
_reset_data
Internal method used for reseting the data on the user currently instantiated.
_reset_error
Internal method used for reseting the error information on the last method call.
_setup_people_api
Internal method used to setup the Flickr::API::People object.
_setup_photosets_api
Internal method used to setup the Flickr::API::Photosets object.
do_getInfo
Internal method used to parse the result from the Flickr::API::People::getInfo method and fill in our data with it's results.
do_getList
Internal method used to parse the result from the Flickr::API::Photosets::getList method and fill in our data with it's results.
AUTHOR
Nuno Nunes, <nfmnunes@cpan.org>
COPYRIGHT & LICENSE
Copyright 2005 Nuno Nunes, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
<http://www.flickr.com/>, Flickr::Photo, Flickr::Photoset