NAME WWW::Ofoto - A module to interact with the Ofoto (now Kodakgallery) website SYNOPSIS use WWW::Ofoto; my $ofoto = WWW::Ofoto->new( { email => 'me@home.com', passwd => 'mypasswd', } ); # login to your account $ofoto->login() or die "couldn't login"; # get a hash of your current photo albums use DateTime; my $albums = $ofoto->list_albums; for my $album (keys %$albums){ my $album = $albums->{$name}; printf "Album %s has %d photos and was created on %s\n", $name, $album->{count}, $album->{date}->mdy; } # upload photos to a new album $count = $ofoto->upload_new_album( { title => 'Nov 2005 Beach', desc => 'Pictures from my beach vacation', date => DateTime->now, pics => [ 'pic1.jpg', 'pic2.jpg' ], } ); # upload photos to an existing album $result = $ofoto->upload_to_album( { title => 'Nov 2005 Beach', pics => [ 'pic3.jpg', 'pic4.jpg'], } ); DESCRIPTION This module provides a basic interface to the Ofoto (now KodakGallery) website ("http://www.ofoto.com/" or "http://wwww.kodakgallery.com/"). It is based on the excellent "WWW::Mechanize" module by Andy Lester. I also requires the "DateTime" module to handle dates. CLASS METHODS new() my $ofoto = WWW::Ofoto->new( { email => 'me@home.com', passwd => 'mypasswd', } ); Constructor - Creates and returns a new "WWW::Ofoto" object. Typically you will want to pass in your email and password for the Ofoto site, but they can be set later via accessors. Returns the created object or croaks if there is error. OBJECT METHODS $ofoto->login() $ofoto->login() or die "couldn't login"; Logs into the Ofoto website using the email and password supplied in the constructor or through the "email" and "passwd" accessors. Returns true if the login was successful. $ofoto->list_albums() my $albums = $ofoto->list_albums; Retrieves a summary the user's photo albums from the Ofoto website. Which is returned as a reference to a hash of hashes. Croaks or returns an empty hash if there is an error. The photo album titles are the keys to the hash, and "count", "date", and "link" are the keys to the value hash: for my $album (keys %$albums){ my $album = $albums->{$name}; printf "Album %s has %d photos and was created on %s\n", $name, $album->{count}, $album->{date}->mdy; } $ofoto->upload_new_album() $count = $ofoto->upload_new_album( { title => 'Nov 2005 Beach', desc => 'Pictures from my beach vacation', date => DateTime->now, pics => [ 'pic1.jpg', 'pic2.jpg' ], } ); Takes a the relevant data, creates a new album and uploads the pictures to the Ofoto site. A large number of photos may be sent with each call to "upload_new_album". The method will break the photos into smaller groups and upload each. Will most likely croak if there is any error. The number of photos uploaded is returned. $ofoto->upload_to_album() $result = $ofoto->upload_to_album( { title => 'Nov 2005 Beach', pics => [ 'pic3.jpg', 'pic4.jpg'], } ); Uploads pictures to an existing photo album based on the c. Otherwise functions identically to "upload_new_album". Will most likely croak if there is any error. The number of photos uploaded is returned. $ofoto->email() $ofoto->passwd() $ofoto->debug() Accessors to retrieve or set their internal values. $ofoto->dump2file() Utility function to print the last webpage loaded by "WWW::Ofoto" as is stored via "content()" in the "WWW::Mechanize" agent. See the "WWW::Mechanize" documentation for more information. If an arguement is supplied, it is used as the filename to write to with ".html" added as an an extention. If not arguement is provied, it will write to "t.html". Any existing file will be overwritten. SEE ALSO The "WWW::Mechanize" module. AUTHOR Mark V. Grimes, <mgrimes@cpan.org> COPYRIGHT AND LICENSE Copyright (C) 2005 by mgrimes This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.