Aaron Straup Cope
and 1 contributors

NAME

Net::Flickr::Simile::Exhbit - OOP for generating Simile Exhibit files using the Flickr API

SYNOPSIS

 use Getopt::Std;
 use Config::Simple;
 use Net::Flickr::Simile::Exhibit;

 my %opts = ();
 getopts('c:j:h:t:', \%opts);

 my $cfg = Config::Simple->new($opts{'c'});

 my %args = ('exhibit_json' => $opts{'j'},
             'exhibit_html' => $opts{'h'},
             'tags' => $opts{'t'});

 my $fl = Net::Flickr::Simile::Exhibit->new($cfg);
 $fl->search(\%args);
 
 # So then you might do :
 # perl ./myscript -c /my/flickr.cfg -h ./mystuff.html -j ./mystuff.js -t kittens

DESCRIPTION

OOP for generating Simile Exhibit files using the Flickr API.

OPTIONS

Options are passed to Net::Flickr::Backup using a Config::Simple object or a valid Config::Simple config file. Options are grouped by "block".

flick

  • api_key

    String. required

    A valid Flickr API key.

  • api_secret

    String. required

    A valid Flickr Auth API secret key.

  • auth_token

    String. required

    A valid Flickr Auth API token.

  • api_handler

    String. required

    The api_handler defines which XML/XPath handler to use to process API responses.

    • LibXML

      Use XML::LibXML.

    • XPath

      Use XML::XPath.

reporting

  • enabled

    Boolean.

    Default is false.

  • handler

    String.

    The default handler is Screen, as in Log::Dispatch::Screen

  • handler_args

    For example, the following :

     reporting_handler_args=name:foobar;min_level=info

    Would be converted as :

     (name      => "foobar",
      min_level => "info");

    The default name argument is "__report". The default min_level argument is "info".

PACKAGE METHODS

__PACKAGE__->new($cfg)

Where $cfg is either a valid Config::Simple object or the path to a file that can be parsed by Config::Simple.

Returns a Net::Flickr::Simile::Exhbit object.

OBJECT METHODS YOU SHOULD CARE ABOUT

Net::Flickr::Simile::Exhibit subclasses Net::Flickr::Simile and Net::Flickr::API so all of those methods are available to your object. The following methods are also defined.

$obj->getRecentPhotos(\%args)

Valid arguments are anything you would (need to) pass to the flickr.photos.search API method and :

  • exhibit_json

    String. required

    The path where Exhbit JSON data should be written to disk.

  • exhibit_html

    String. required

    The path where Exhbit HTML data should be written to disk. It will contain a relative pointer to exhibit_json.

The user_id bound to the Flickr Auth token defined in the object's config file will automatically be added to the method arguments and used to scope the query.

Returns true or false.

$obj->search(\%args)

Valid arguments are anything you would (need to) pass to the flickr.photos.search API method and :

  • exhibit_json

    String. required

    The path where Exhbit JSON data should be written to disk.

  • exhibit_html

    String. required

    The path where Exhbit HTML data should be written to disk. It will contain a relative pointer to exhibit_json.

Returns true or false.

$obj->getContactsPhotos(\%args)

Valid arguments are anything you would (need to) pass to the flickr.photos.getContactsPhotos API method and :

  • exhibit_json

    String. required

    The path where Exhbit JSON data should be written to disk.

  • exhibit_html

    String. required

    The path where Exhbit HTML data should be written to disk. It will contain a relative pointer to exhibit_json.

Returns true or false.

$obj->getContactsPublicPhotos(\%args)

Valid arguments are anything you would (need to) pass to the flickr.photos.getContactsPublicPhotos API method and :

  • exhibit_json

    String. required

    The path where Exhbit JSON data should be written to disk.

  • exhibit_html

    String. required

    The path where Exhbit HTML data should be written to disk. It will contain a relative pointer to exhibit_json.

Returns true or false.

OBJECT METHODS YOU MAY CARE ABOUT

$obj->rspToExhibitJson($rsp)

Where $rsp is the return value of a call to Net::Flickr::API-api_call>.

Returns a JSON string representing the data in $rsp suitable for including with a Simile Exhibit document.

$obj->writeExhbitFiles(\%paths, $rsp)

Returns true or false.

$obj->writeExhibitJson($path, $rsp)

Returns true or false

$obj->writeExhibitHtml($path, $rsp)

Returns true or false

VERSION

0.1

AUTHOR

Aaron Straup Cope <ascope@cpan.org>

NOTES

  • helper methods

    Basically anything that returns a "standard photo response" (or /rsp/photos/photo) from the Flickr API can be used with this package to generate Exhibit data.

    As this time, however, only a handful of (API) methods have (Perl) helper methods. There will be others.

  • pagination

    This package does not know how to account for pagination in the Flickr API. That may change over time.

  • HTML files

    This package contains a bare-bones template for generating an HTML file to view your Exhibit data.

    You may need to tweak the output after the fact or you can subclass the readExhibitHtml method.

EXAMPLES

http://aaronland.info/perl/net/flickr/simile/exhibit.html

http://aaronland.info/perl/net/flickr/simile/exhibit.js

SEE ALSO

Net::Flickr::API

http://simile.mit.edu/exhibit/

BUGS

Please report all bugs via http://rt.cpan.org/

LICENSE

Copyright (c) 2007 Aaron Straup Cope. All Rights Reserved.

This is free software. You may redistribute it and/or modify it under the same terms as Perl itself.