Net::PicApp - A toolkit for interacting with the PicApp service.
my $picapp = Net::PicApp->new({ apikey => '4d8c591b-e2fc-42d2-c7d1-xxxabc00d000' }); my $response = $picapp->search('cats'); if ($response->is_success) { foreach my $img (@{$response->images}) { print $img->imageTitle . "\n"; } } else { die $picapp->error_message; }
This module provides a convenient interface to the PicApp web service. It requires that you have been given an API Key by PicApp.
This function receives a term for searching and retrieves the results in XML. This function allows the user to send search parameters in addition to the search term, corresponding to advanced search options in the www.picapp.com website.
Search Options:
no_cache
with_thumbnails
category
subcategory
colors
orientation
types
match_phrase
time_period
sort
page
total_records
Usage Notes:
If with_thumbnails has been specified and is true, then this function will retrieve the search results upon user definitions with extra rectangular cropped thumbnails on top of the regular thumbnail. These thumbnails will be available in the response object.
If subcategory OR contributor has been specified then this function will also filter the search results by image contributor (Getty, Corbis, Splash, etc..) and by image category (news, creative, sports, etc..)
contributor
This function receives the unique key and the image ID (the image ID received from the search XML results).
Options:
This function receives a login name a password and retrieves an xml with the user details.
This function receives an image ID, the search terms used to find the image and an email address and then retrieves the script in XML.
size
image_frame
The following constants have been defined to assist in specifying the appropriate values to a search request:
Each of the following options are also accessors on the main Net::PicApp object.
The API Key given to you by PicApp for accessing the service.
The base URL of the PicApp service. Defaults to: 'http://api.picapp.com/API/ws.asmx'
A Cache object to use for caching results.
Responses returned by Amazon's web service can be cached locally. Net::Amazon's new method accepts a reference to a Cache object. Cache (or one of its companions like Cache::Memory, Cache::File, etc.) can be downloaded from CPAN, please check their documentation for details. In fact, any other type of cache implementation will do as well, see the requirements below.
Here's an example utilizing a file cache which causes Net::PicApp to cache responses for 30 minutes:
use Cache::File; my $cache = Cache::File->new( cache_root => '/tmp/mycache', default_expires => '30 min', ); my $picapp = Net::PicApp->new( apikeykey => 'YOUR_APIKEY', cache => $cache, );
http://github.com/byrnereese/perl-Net-PicApp
Author: Byrne Reese <byrne@majordojo.com>
To install Net::PicApp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::PicApp
CPAN shell
perl -MCPAN -e shell install Net::PicApp
For more information on module installation, please visit the detailed CPAN module installation guide.