
Net::Safari - Wrapper for Safari Online Books API

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();
}

You can read more about Safari webservices here: http://safari.oreilly.com/affiliates/?p=web_services

$agent = Net::Safari->new( token => 'MY_SAFARI_TOKEN' );
Construct a Safari object. Token seems optional.

$res = $ua->search( BOOKTITLE => 'samba' ); Search book titles. This is currently broken in Safari. See: http://safari.oreilly.com/xmlapi/?search=BOOKTITLE%20LIKE%20XML
$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.
$res = $ua->search( ISBN => '059600415X' ); ISBN must be a complete ISBN, partial ISBN searches don't work.
$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.
$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.
$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
$res = $ua->search( AUTHOR => 'Wall' ); $res = $ua->search( AUTHOR => 'Wall, Larry' ); $res = $ua->search( AUTHOR => 'Larry Wall' ); Search by author.
$res = $ua->search( PUBLDATE => '> 20041001' ); $res = $ua->search( PUBLDATE => '< 20030101' ); Search before or after a given publish date. The comparison operator, > or < is required.
$res = $ua->search( PUBLISHER => "O'Reilly" ); Search by publisher.



Tony Stubblebine cpan@tonystubblebine.com

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.
