NAME
Net::Safari - Wrapper for Safari Online Books API
SYNOPSIS
use Net::Safari
my $ua = Net::Safari->new(token => 'YOUR_SAFARI_TOKEN');
my $response = $ua->search();
if($response->is_success()) {
print $response->as_string();
}
else {
print "Error:" . $response->message();
}
DESCRIPTION
You can read more about Safari webservices here: http://safari.oreilly.com/affiliates/?p=web_services
METHODS
new()
$agent = Net::Safari->new( token => 'MY_SAFARI_TOKEN' );
Construct a Safari object. Token seems optional.
SEARCH
BOOKTITLE
$res = $ua->search( BOOKTITLE => 'samba' );
Search book titles. This is currently broken in Safari.
See: http://safari.oreilly.com/xmlapi/?search=BOOKTITLE%20LIKE%20XML
TITLE
$res = $ua->search( TITLE => 'samba' );
Searches section titles. Will sometimes return book titles if it can't find
any sections. I consider this a bug.
ISBN
$res = $ua->search( ISBN => '059600415X' );
ISBN must be a complete ISBN, partial ISBN searches don't work.
CODE
$res = $ua->search( CODE => 'Test::More' );
Search within code fragments. This is usually a lot more than programlistings. Code snippets that appear within a sentence are usually semanticly tagged as code. So you're just as likely to get text as you are to get program listings with this search.
NOTE
$res = $ua->search( NOTE => "web services" );
The documentation says, "Finds matches within Tips and How-Tos." However the results seem to indicate hits in the content.
CATEGORY
$res = $ua->search( CATEGORY => "itbooks.security" );
Search within a category. The list of categories is here:
http://safari.oreilly.com/affiliates/portals/safari/2004-07-30_Safari_Books_Category_Metadata_Abbreviations.doc
AUTHOR
$res = $ua->search( AUTHOR => 'Wall' );
$res = $ua->search( AUTHOR => 'Wall, Larry' );
$res = $ua->search( AUTHOR => 'Larry Wall' );
Search by author.
PUBLDATE
$res = $ua->search( PUBLDATE => '> 20041001' );
$res = $ua->search( PUBLDATE => '< 20030101' );
Search before or after a given publish date. The comparison operator, > or < is required.
PUBLISHER
$res = $ua->search( PUBLISHER => "O'Reilly" );
Search by publisher.
BUGS
SUPPORT
AUTHOR
Tony Stubblebine
cpan@tonystubblebine.com
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.