NAME
Flickr::Photoset - Represents a photoset on Flickr.
VERSION
Version 0.03
SYNOPSIS
use Flickr::Photoset;
my $photoset = Flickr::Photoset->new($flickr_api_key);
if ($photoset->id({id => 12345678})) {
my $title = $photoset->title;
my $owner = $photoset->owner;
}
DESCRIPTION
This class represents a photoset on Flickr. It uses the Flickr::API::Photosets class (and other's it finds necessary) in order to retrieve and send information to/from Flickr regarding a photoset.
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.
$photoset = Flickr::Photoset->new($my_flickr_api_key, $my_flickr_email, $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});
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 photoset it is currently representing (assuming there is one photoset 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 photoset whose ID you just passed in and resets itself accordingly, deleting any data it might have had from a previous photoset, and gets the basic information on the photoset you requested.
$ok = $p->id($photoset_id);
Always returns undef on error. Also on error the $p->{error} structure will be defined.
title
Returns the title of the photoset.
$title = $p->title;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
description
Returns the description of the photoset.
$description = $p->description;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
secret
Returns the secret of the photoset (if you have access to it).
$secret = $p->secret;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
primary
Returns the ID of the primary photo in this photoset.
$primary = $p->primary;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
num_photos
Returns the number of photos in this photoset.
$num_photos = $p->num_photos;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
owner
Returns a Flickr::Person object representing the owner of this photoset.
$person = $p->owner;
Always returns undef on error. Also on error the $p->{error} structure will be defined.
photos
Returns as array of Flickr::Photo objects, representing the photos that belong to this photoset.
$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 photoset.
_reset_error
Internal method used for reseting the error information on the last method call.
_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::Photosets::getInfo method and fill in our data with it's results.
_do_getContext
Internal method used to parse the result from the Flickr::API::Photosets::getContext method and fill in our data with it's results.
_do_getPhotos
Internal method used to parse the result from the Flickr::API::Photosets::getPhotos 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::Person, Flickr::Photo