GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::GOOGLE (3)

.ds Aq ’

NAME

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

CONTENTS

SYNOPSIS



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



DESCRIPTION

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

ENCODING

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.)

PACKAGE METHODS

    __PACKAGE__->new(\%args)

Valid arguments are :
o <B>keyB>

string. A Google API key.

o <B>http_proxyB>

url. A URL for proxy-ing HTTP requests.

o <B>debugB>

Valid options are:
o boolean

If true prints debugging information returned by SOAP::Lite to STDERR

o coderef.

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!

OBJECT METHODS

CW$obj->key($string)

Get/set the Google API key for this object.

CW$obj->http_proxy($url)

Get/set the HTTP proxy for this object.

Returns a string.

CW$obj->search(\%args)

Valid arguments are :
o <B>keyB>

string. A Google API key.

If none is provided then the key passed to the parent Net::Google object will be used.

o <B>starts_atB>

int. First result number to display.

Default is 0.

o <B>max_resultsB>

int. Number of results to return.

Default is 10.

o <B>lrB>

string or array reference. Language restrictions.

o <B>safeB>

boolean.

o <B>filterB>

boolean.

o <B>http_proxyB>

url. A URL for proxy-ing HTTP requests.

o <B>debugB>

Valid options are:
o boolean

If true prints debugging information returned by SOAP::Lite to STDERR

o coderef

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.

CW$obj->spelling(\%args)

Valid arguments are:
o <B>keyB>

string. A Google API key.

If none is provided then the key passed to the parent Net::Google object will be used.

o <B>phraseB>

string or array reference.

o <B>http_proxyB>

url. A URL for proxy-ing HTTP requests.

o <B>debugB>
o <B>booleanB>

Prints debugging information returned by SOAP::Lite to STDERR

o <B>coderefB>

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.

CW$obj->cache(\%args)

Valid arguments are :
o <B>keyB>

String. Google API key.

If none is provided then the key passed to the parent Net::Google object will be used.

o <B>urlB>

string

o <B>http_proxyB>

url. A URL for proxy-ing HTTP requests.

o <B>debugB>

Valid options are:
o boolean

If true, prints debugging information returned by SOAP::Lite to STDERR

o coderef

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.

CW$obj->queries_exhausted()

Returns true or false depending on whether or not the current in-memory <B>sessionB> has exhausted the Google API 1000 query limit.

VERSION

1.0

DATE

$Date: 2006/01/12 03:37:31 $

AUTHOR

Aaron Straup Cope

CONTRIBUTORS

Marc Hedlund <marc@precipice.org>

SEE ALSO

http://www.google.com/apis

Net::Google::Search

Net::Google::Spelling

Net::Google::Cache

Net::Google::Response

Net::Google::Service

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

TO DO

o Tickle the tests so that they will pass on systems without Test::More.
o Add tests for filters.
o Add some sort of functionality for managing multiple keys. Sort of like what is describe here :

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.

BUGS

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

LICENSE

Copyright (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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::GOOGLE (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.