NAME
WWW::Phanfare::Class - Object interface to Phanfare library
VERSION
Version 0.03
SYNOPSIS
use WWW::Phanfare::Class;
$class = WWW::Phanfare::Class->new(
api_key => 'secret',
private_key => 'secret',
email_address => 's@c.et',
password => 'secret',
);
# Site Name
my($sitename) = $class->account->names;
# Site Object
my $site = $class->account->$sitename;
# Album Names
my @albums = $site->names;
# Photo filenames in Album's Main Section
my @filenames = $site->"Family Vacation"->"Main Section"->Full->names;
# Upload Image and set Caption
my $folder = $site->"Family Vacation"->"Main Section"->Full;
my $image = $folder->add( 'filename.jpg', slurp 'filename.jpg', '2009-09-15T00:00:00' );
$image->attribute( Caption => 'Family on Vacation' );
DESCRIPTION
WWW::Phanfare::Class creates an object tree for Phanfare site. Each Phanfare object can be referred to by name or by object reference.
BEFORE GETTING STARTED
Users of this module must possess own Phanfare account and API key.
TREE HIERARKI
Class is the top object and it has one Account to access data using Phanfare API.
The tree hierarki is as follows:
An Account has a nuber of Sites.
A Site has a number of Years.
A Year has a number of Albums.
An Album has a number of Sections.
A Section has a number of Renditions.
A Rendition has a number of Images.
NAME CLASH
In Phanfare it's possible for multiple objects to have same name. For example multi albums can have same name. In such cases WWW::Phanfare::Class will append the id on the names that are not uniq. Example:
Kids Photos
Family Vacation.12345678
Family Vacation.12345789
METHODS
Each object implements the following methods.
parent
$object->parent();
The parent object.
names
my @childrennames = $object->names;
The names of child objects. For example for an Album it will return the names of all sections.
list
my @children_objects = $object->list;
All child objects.
get($name)
my $child = $object->get($name);
my $child = $object->$name;
Access child object by name. Append ID when there is a name clash.
If no ID is appended on name clash, then a random matching object is returned.
add($name, $value?, $date?)
# Create Branch Node
$object->add($name);
# Create Leaf Node
$object->add($name, $value);
# Create Image with Date
$object->add($name, $value, $date);
Create a new child object. When creating a Branch, such as for example an Album, no value must be set.
For Images, a value can be provided, which is the raw image data. Date may be optionally provided as well.
remove($name)
$object->remove($name);
Remove a child object by name. For certain objects it removes all child objects recursive. For example when removing an Album, it will also remove all Sections and Images belonging to Album.
Removing a Year is not possible as long as there are Albums in the Year. The Year will be automatically remove when all Albums in the Year have been removed.
Site and Account cannot be removed.
ATTRIBUTES
Account. Album, Section and Image objects have attributes.
For classes with attributes, the follow addition attribute accessors are available to the object.
attributes
@attribute_names = $object->attributes;
List of names of attributes.
setattributes($hashreference)
$object->setattributes({
name1 => $value1,
name2 => $value2,
... => ...,
});
Set values of multiple attributes.
attribute($name, $value?)
$object->attribute( $name => $value );
$value = $object->attribute( $name );
Read or write an attribute value.
VALUE
Image raw data is uploaded or downloaded with value accessor. No other object have value.
value($data?)
$image = slurp 'filename.jpg';
$object->value( $image );
$image = $object->value;
Get or set image data.
Images can only be upload in Full rendition. All other renditions are for download only.
DATES
Dates follow same formats as on Phanfare. Example:
2009-09-15T00:00:00
PERFORMANCE CONSIDERATIONS
WWW::Phanfare::API is used for communication with Phanfare Rest/XML API. Results of queries are each cached for 30 seconds to limit network traffic and to improve performance.
SEE ALSO
AUTHOR
Soren Dossing, <netcom at sauber.net>
BUGS
Please report any bugs or feature requests to bug-www-phanfare-class at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Phanfare-Class. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc WWW::Phanfare::Class
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2011 Soren Dossing.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.