Catalyst::Model::ISBNDB - Provide Catalyst access to isbndb.com
package MyApp::Model::ISBNDB; use base 'Catalyst::Model::ISBNDB'; __PACKAGE__->config(access_key => 'XXX'); # Within a Catalyst application: my $book = $c->model('ISBNDB')->find_book($isbn);
This package provides a Catalyst model that makes requests of the isbndb.com web service, using their published REST interface. The model creates an instance of the WebService::ISBNDB::API class and uses it as a factory for making requests for data in any of the classes supported (Authors, Books, Categories, Publishers and Subjects).
The model requires the application to configure a valid access key from the isbndb.com service:
__PACKAGE__->config(access_key => $KEY)
No other configuration is needed. If you choose to load and manipulate the WebService::ISBNDB::API class directly, you may also use the set_default_api_key method of that class to set your access key.
set_default_api_key
The following methods are available to users or sub-classes:
Find a single record of the respective type, using the ID. When searching for a book, the ISBN may be specified instead of an ID. Returns the matching object, undef if no match is found, or throws an exception if an error occurs.
undef
Perform a search for the respective type of records. The parameter is a hash-reference of search terms, as defined in the corresponding manual pages for the types that derive from WebService::ISBNDB::API. The return value is a WebService::ISBNDB::Iterator instance. An exception is thrown on error.
This method is called by the previous methods to retrieve the internal API factory agent. If one has not yet been created, it is first created and then returned.
The first time get_agent() is called, it calls this method to allocate an instance of WebService::ISBNDB::API. The single parameter is the configuration information from Catalyst. This is used to look up the access key that would have been configured when the application started. The return value is either an API object instance, or an exception is thrown to signal an error.
In order to access the isbndb.com service, you must register on their site and create an API access key.
WebService::ISBNDB::API, WebService::ISBNDB::Iterator
Please report any bugs or feature requests to bug-catalyst-model-isbndb at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Model-ISBNDB. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-catalyst-model-isbndb at rt.cpan.org
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Model-ISBNDB
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Catalyst-Model-ISBNDB
CPAN Ratings
http://cpanratings.perl.org/d/Catalyst-Model-ISBNDB
Search CPAN
http://search.cpan.org/dist/Catalyst-Model-ISBNDB
Source code on GitHub
http://github.com/rjray/catalyst-model-isbndb/tree/master
This file and the code within are copyright (c) 2009 by Randy J. Ray.
Copying and distribution are permitted under the terms of the Artistic License 2.0 (http://www.opensource.org/licenses/artistic-license-2.0.php) or the GNU LGPL 2.1 (http://www.opensource.org/licenses/lgpl-2.1.php).
Randy J. Ray <rjray@blackperl.com>
<rjray@blackperl.com>
To install Catalyst::Model::ISBNDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Model::ISBNDB
CPAN shell
perl -MCPAN -e shell install Catalyst::Model::ISBNDB
For more information on module installation, please visit the detailed CPAN module installation guide.