Flickr CPAN module

Toby Wintermute tjc at wintrmute.net
Tue Mar 22 08:39:16 GMT 2011


On 22 March 2011 19:20, Dave Hodgkinson <davehodg at gmail.com> wrote:
> On 22 Mar 2011, at 02:04, Toby Wintermute wrote:
>> On 22 March 2011 05:59, Dave Hodgkinson <davehodg at gmail.com> wrote:
>>> On 21 Mar 2011, at 02:17, Toby Wintermute wrote:
>>>> On 10 March 2011 08:27, Dave Hodgkinson <davehodg at gmail.com> wrote:
>>>>> Which is preferred?
>>>>>
>>>>> There are a few by people I would trust so I'm confused!
>>>>
>>>> I'm rather dissatisfied by the current Flickr::API, so have been
>>>> working on a new/forked version of it.
>>>> I'm not quite ready to release yet, but perhaps you'd like to help?
>>>>
>>>> https://github.com/TJC/Flickr-API2
>>>
>>> I was toying with a use-case driven Flickr::API::Useful based around
>>> things you actually want from it...
>>
>> I'd love to have something like that in Flickr::API2 :)
>
> As a subclass. or uses ::API2.

I was thinking in the API2:: namespace at least; something so that you
could do something like:

use Flickr::API2 ':foo';
my $f = Flickr::API2->new(...auth stuff...);
$f->getPhotos(tag => "cats")->foreach(sub { my $photo = shift; say
$photo->title });

>> ie. A way to ask for photos, and to be given back an iterator of
>> Flickr::...::Photo objects, rather than the current method which is
>> just a big hash of keys that vary depending on what objects you've
>> been given.
>>
>> (Hey, but at least it's an improvement on the old CPAN module, which
>> returned an XML::Parser::Lite::Tree document and expected you to know
>> how to query Yet Another XML Module.)
>
> What? That's how you do it?

The Flickr.com API used to just return XML data; the old Flickr::API
module basically just parsed it back to you verbatim, albeit via an
XML parsing module the author also wrote.
It didn't really make it easy to adopt the module for use.

The current F::API2 module uses the JSON version of the Flickr API,
and so can pass back a reasonably sane Perl structure.

Toby

-- 
Turning and turning in the widening gyre
The falcon cannot hear the falconer
Things fall apart; the center cannot hold
Mere anarchy is loosed upon the world


More information about the london.pm mailing list