NAME

Flickr::License::Helper - Helper class to grab details of the currently supported licenses on Flickr

VERSION

Version 0.01

SYNOPSIS

my $helper = Flickr::License::Helper->get_instance($APIKEY);

my $license_name = $helper->licenses->{$license_id}{name};
my $license_url = $helper->licenses->{}$license_id}{url};

DESCRIPTION

The class is a singleton that caches the data returned by the flickr.photo.getLicenses api call in a simple hash.

It only grabs the data when the API key is set or changed, or if the refresh function is explicitly called.

METHODS

api_key

Returns the current api_key. If an argument is passed in that is set to be the current api_key.

If the key has changed then the license data is refreshed from flickr

refresh

Refreshes the internal cache from flickr

licenses

Returns a handle to the internal cache of licenses. The structure should look something like this:

{
    '6' => {
            'url' => 'http://creativecommons.org/licenses/by-nd/2.0/',
            'name' => 'Attribution-NoDerivs License'
           },
    '1' => {
            'url' => 'http://creativecommons.org/licenses/by-nc-sa/2.0/',
            'name' => 'Attribution-NonCommercial-ShareAlike License'
           },
    '4' => {
            'url' => 'http://creativecommons.org/licenses/by/2.0/',
            'name' => 'Attribution License'
           },
    '3' => {
            'url' => 'http://creativecommons.org/licenses/by-nc-nd/2.0/',
            'name' => 'Attribution-NonCommercial-NoDerivs License'
           },
    '0' => {
            'url' => '',
            'name' => 'All Rights Reserved'
           },
    '2' => {
            'url' => 'http://creativecommons.org/licenses/by-nc/2.0/',
            'name' => 'Attribution-NonCommercial License'
           },
    '5' => {
            'url' => 'http://creativecommons.org/licenses/by-sa/2.0/',
            'name' => 'Attribution-ShareAlike License'
            }
}

AUTHOR

Billy Abbott, <billy@cowfish.org.uk>

COPYRIGHT & LICENSE

Copyright 2007 Billy Abbott, 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::API, Flickr::Photo