|
NAMENet::Google - simple OOP-ish interface to the Google SOAP APISYNOPSISuse 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(); DESCRIPTIONProvides a simple OOP-ish interface to the Google SOAP APIENCODINGAccording 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.) PACKAGE METHODS__PACKAGE__->new(\%args)Valid arguments are :
Note that prior to version 0.60, arguments were not passed by reference. Versions >= 0.60 are backwards compatible. Returns an object. Woot! OBJECT METHODS$obj->key($string)Get/set the Google API key for this object.$obj->http_proxy($url)Get/set the HTTP proxy for this object.Returns a string. $obj->search(\%args)Valid arguments are :
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. $obj->spelling(\%args)Valid arguments are:
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. $obj->cache(\%args)Valid arguments are :
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. $obj->queries_exhausted()Returns true or false depending on whether or not the current in-memory session has exhausted the Google API 1000 query limit.VERSION1.0DATE$Date: 2006/01/12 03:37:31 $AUTHORAaron Straup CopeCONTRIBUTORSMarc Hedlund <marc@precipice.org>SEE ALSOhttp://www.google.com/apisNet::Google::Search Net::Google::Spelling Net::Google::Cache Net::Google::Response Net::Google::Service http://aaronland.info/weblog/archive/4231 TO DO
BUGSPlease report all bugs via http://rt.cpan.orgLICENSECopyright (c) 2002-2005, Aaron Straup Cope. All Rights Reserved.This is free software, you may use it and distribute it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |