
Net::Google - simple OOP-ish interface to the Google SOAP API

use Net::Google;
use constant LOCAL_GOOGLE_KEY => "********************************";
my $google = Net::Google->new(key=>LOCAL_GOOGLE_KEY);
my $search = $google->search();
# Search interface
$search->query(qw(aaron straup cope));
$search->lr(qw(en fr));
$search->starts_at(5);
$search->max_results(15);
map { print $_->title()."\n"; } @{$search->results()};
# or...
foreach my $r (@{$search->response()}) {
print "Search time :".$r->searchTime()."\n";
# returns an array ref of Result objects
# the same as the $search->results() method
map { print $_->URL()."\n"; } @{$r->resultElements()};
}
# Spelling interface
print $google->spelling(phrase=>"muntreal qwebec")->suggest(),"\n";
# Cache interface
my $cache = $google->cache(url=>"http://search.cpan.org/recent");
print $cache->get();

Provides a simple OOP-ish interface to the Google SOAP API

According to the Google API docs :
"In order to support searching documents in multiple languages and character encodings the Google Web APIs perform all requests and responses in the UTF-8 encoding. The parameters <ie> and <oe> are required in client requests but their values are ignored. Clients should encode all request data in UTF-8 and should expect results to be in UTF-8."
(This package takes care of setting both parameters in requests.)

Valid arguments are :
string. A Google API key.
url. A URL for proxy-ing HTTP requests.
Valid options are:
If true prints debugging information returned by SOAP::Lite to STDERR
Your own subroutine for munging the debugging information returned by SOAP::Lite.
Note that prior to version 0.60, arguments were not passed by reference. Versions >= 0.60 are backwards compatible.
Returns an object. Woot!

Get/set the Google API key for this object.
Get/set the HTTP proxy for this object.
Returns a string.
Valid arguments are :
string. A Google API key.
If none is provided then the key passed to the parent Net::Google object will be used.
int. First result number to display.
Default is 0.
int. Number of results to return.
Default is 10.
string or array reference. Language restrictions.
boolean.
boolean.
url. A URL for proxy-ing HTTP requests.
Valid options are:
If true prints debugging information returned by SOAP::Lite to STDERR
Your own subroutine for munging the debugging information returned by SOAP::Lite.
Note that prior to version 0.60, arguments were not passed by reference. Versions >= 0.60 are backwards compatible.
Returns a Net::Google::Search object. Woot!
Returns undef if there was an error.
Valid arguments are:
string. A Google API key.
If none is provided then the key passed to the parent Net::Google object will be used.
string or array reference.
url. A URL for proxy-ing HTTP requests.
Prints debugging information returned by SOAP::Lite to STDERR
Your own subroutine for munging the debugging information returned by SOAP::Lite.
If no option is defined then the debug argument passed to the parent Net::Google object will be used.
Note that prior to version 0.60, arguments were not passed by reference. Versions >= 0.60 are backwards compatible.
Returns a Net::Google::Spelling object. Woot!
Returns undef if there was an error.
Valid arguments are :
String. Google API key.
If none is provided then the key passed to the parent Net::Google object will be used.
string
url. A URL for proxy-ing HTTP requests.
Valid options are:
If true, prints debugging information returned by SOAP::Lite to STDERR
Your own subroutine for munging the debugging information returned by SOAP::Lite.
If no option is defined then the debug argument passed to the parent Net::Google object will be used.
Note that prior to version 0.60, arguments were not passed by reference. Versions >= 0.60 are backwards compatible.
Returns a Net::Google::Cache object. Woot!
Returns undef if there was an error.

0.61

$Date: 2004/02/10 04:18:55 $

Aaron Straup Cope

Marc Hedlund <marc@precipice.org>

http://aaronland.info/weblog/archive/4231

http://aaronland.net/weblog/archive/4204
This will probably happen around the time Hell freezes over so if you think you can do it faster, go nuts.

Please report all bugs via http://rt.cpan.org

Copyright (c) 2002-2004, Aaron Straup Cope. All Rights Reserved.
This is free software, you may use it and distribute it under the same terms as Perl itself.