.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Net::Google 3" .TH Net::Google 3 "2008-01-01" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Net::Google \- simple OOP\-ish interface to the Google SOAP API .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Net::Google; \& use constant LOCAL_GOOGLE_KEY => "********************************"; .Ve .PP .Vb 2 \& my $google = Net::Google->new(key=>LOCAL_GOOGLE_KEY); \& my $search = $google->search(); .Ve .PP .Vb 1 \& # Search interface .Ve .PP .Vb 4 \& $search->query(qw(aaron straup cope)); \& $search->lr(qw(en fr)); \& $search->starts_at(5); \& $search->max_results(15); .Ve .PP .Vb 1 \& map { print $_->title()."\en"; } @{$search->results()}; .Ve .PP .Vb 1 \& # or... .Ve .PP .Vb 2 \& foreach my $r (@{$search->response()}) { \& print "Search time :".$r->searchTime()."\en"; .Ve .PP .Vb 4 \& # returns an array ref of Result objects \& # the same as the $search->results() method \& map { print $_->URL()."\en"; } @{$r->resultElements()}; \& } .Ve .PP .Vb 1 \& # Spelling interface .Ve .PP .Vb 1 \& print $google->spelling(phrase=>"muntreal qwebec")->suggest(),"\en"; .Ve .PP .Vb 1 \& # Cache interface .Ve .PP .Vb 2 \& my $cache = $google->cache(url=>"http://search.cpan.org/recent"); \& print $cache->get(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Provides a simple OOP-ish interface to the Google \s-1SOAP\s0 \s-1API\s0 .SH "ENCODING" .IX Header "ENCODING" According to the Google \s-1API\s0 docs : .PP .Vb 6 \& "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 and \& 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." .Ve .PP (This package takes care of setting both parameters in requests.) .SH "PACKAGE METHODS" .IX Header "PACKAGE METHODS" .Sh "_\|_PACKAGE_\|_\->new(\e%args)" .IX Subsection "__PACKAGE__->new(%args)" Valid arguments are : .IP "\(bu" 4 \&\fBkey\fR .Sp \&\fIstring\fR. A Google \s-1API\s0 key. .IP "\(bu" 4 \&\fBhttp_proxy\fR .Sp \&\fIurl\fR. A \s-1URL\s0 for proxy-ing \s-1HTTP\s0 requests. .IP "\(bu" 4 \&\fBdebug\fR .Sp Valid options are: .RS 4 .IP "\(bu" 4 \&\fIboolean\fR .Sp If true prints debugging information returned by SOAP::Lite to \s-1STDERR\s0 .IP "\(bu" 4 \&\fIcoderef\fR. .Sp Your own subroutine for munging the debugging information returned by SOAP::Lite. .RE .RS 4 .RE .PP Note that prior to version 0.60, arguments were not passed by reference. Versions >= 0.60 are backwards compatible. .PP Returns an object. Woot! .SH "OBJECT METHODS" .IX Header "OBJECT METHODS" .Sh "$obj\->key($string)" .IX Subsection "$obj->key($string)" Get/set the Google \s-1API\s0 key for this object. .Sh "$obj\->http_proxy($url)" .IX Subsection "$obj->http_proxy($url)" Get/set the \s-1HTTP\s0 proxy for this object. .PP Returns a string. .Sh "$obj\->search(\e%args)" .IX Subsection "$obj->search(%args)" Valid arguments are : .IP "\(bu" 4 \&\fBkey\fR .Sp \&\fIstring\fR. A Google \s-1API\s0 key. .Sp If none is provided then the key passed to the parent \&\fINet::Google\fR object will be used. .IP "\(bu" 4 \&\fBstarts_at\fR .Sp \&\fIint\fR. First result number to display. .Sp Default is 0. .IP "\(bu" 4 \&\fBmax_results\fR .Sp \&\fIint\fR. Number of results to return. .Sp Default is 10. .IP "\(bu" 4 \&\fBlr\fR .Sp \&\fIstring\fR or \fIarray reference\fR. Language restrictions. .IP "\(bu" 4 \&\fBsafe\fR .Sp \&\fIboolean\fR. .IP "\(bu" 4 \&\fBfilter\fR .Sp \&\fIboolean\fR. .IP "\(bu" 4 \&\fBhttp_proxy\fR .Sp \&\fIurl\fR. A \s-1URL\s0 for proxy-ing \s-1HTTP\s0 requests. .IP "\(bu" 4 \&\fBdebug\fR .Sp Valid options are: .RS 4 .IP "\(bu" 4 \&\fIboolean\fR .Sp If true prints debugging information returned by SOAP::Lite to \s-1STDERR\s0 .IP "\(bu" 4 \&\fIcoderef\fR .Sp Your own subroutine for munging the debugging information returned by SOAP::Lite. .RE .RS 4 .RE .PP Note that prior to version 0.60, arguments were not passed by reference. Versions >= 0.60 are backwards compatible. .PP Returns a \fINet::Google::Search\fR object. Woot! .PP Returns undef if there was an error. .Sh "$obj\->spelling(\e%args)" .IX Subsection "$obj->spelling(%args)" Valid arguments are: .IP "\(bu" 4 \&\fBkey\fR .Sp \&\fIstring\fR. A Google \s-1API\s0 key. .Sp If none is provided then the key passed to the parent \&\fINet::Google\fR object will be used. .IP "\(bu" 4 \&\fBphrase\fR .Sp \&\fIstring\fR or \fIarray reference\fR. .IP "\(bu" 4 \&\fBhttp_proxy\fR .Sp \&\fIurl\fR. A \s-1URL\s0 for proxy-ing \s-1HTTP\s0 requests. .IP "\(bu" 4 \&\fBdebug\fR .RS 4 .IP "\(bu" 4 \&\fBboolean\fR .Sp Prints debugging information returned by SOAP::Lite to \s-1STDERR\s0 .IP "\(bu" 4 \&\fBcoderef\fR .Sp Your own subroutine for munging the debugging information returned by SOAP::Lite. .RE .RS 4 .Sp If no option is defined then the debug argument passed to the parent \&\fINet::Google\fR object will be used. .RE .PP Note that prior to version 0.60, arguments were not passed by reference. Versions >= 0.60 are backwards compatible. .PP Returns a \fINet::Google::Spelling\fR object. Woot! .PP Returns undef if there was an error. .Sh "$obj\->cache(\e%args)" .IX Subsection "$obj->cache(%args)" Valid arguments are : .IP "\(bu" 4 \&\fBkey\fR .Sp String. Google \s-1API\s0 key. .Sp If none is provided then the key passed to the parent \fINet::Google\fR object will be used. .IP "\(bu" 4 \&\fBurl\fR .Sp \&\fIstring\fR .IP "\(bu" 4 \&\fBhttp_proxy\fR .Sp \&\fIurl\fR. A \s-1URL\s0 for proxy-ing \s-1HTTP\s0 requests. .IP "\(bu" 4 \&\fBdebug\fR .Sp Valid options are: .RS 4 .IP "\(bu" 4 \&\fIboolean\fR .Sp If true, prints debugging information returned by SOAP::Lite to \s-1STDERR\s0 .IP "\(bu" 4 \&\fIcoderef\fR .Sp Your own subroutine for munging the debugging information returned by SOAP::Lite. .RE .RS 4 .Sp If no option is defined then the debug argument passed to the parent \&\fINet::Google\fR object will be used. .RE .PP Note that prior to version 0.60, arguments were not passed by reference. Versions >= 0.60 are backwards compatible. .PP Returns a \fINet::Google::Cache\fR object. Woot! .PP Returns undef if there was an error. .Sh "$obj\->\fIqueries_exhausted()\fP" .IX Subsection "$obj->queries_exhausted()" Returns true or false depending on whether or not the current in-memory \&\fBsession\fR has exhausted the Google \s-1API\s0 1000 query limit. .SH "VERSION" .IX Header "VERSION" 1.0 .SH "DATE" .IX Header "DATE" $Date: 2006/01/12 03:37:31 $ .SH "AUTHOR" .IX Header "AUTHOR" Aaron Straup Cope .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" Marc Hedlund .SH "SEE ALSO" .IX Header "SEE ALSO" http://www.google.com/apis .PP Net::Google::Search .PP Net::Google::Spelling .PP Net::Google::Cache .PP Net::Google::Response .PP Net::Google::Service .PP http://aaronland.info/weblog/archive/4231 .SH "TO DO" .IX Header "TO DO" .IP "\(bu" 4 Tickle the tests so that they will pass on systems without Test::More. .IP "\(bu" 4 Add tests for filters. .IP "\(bu" 4 Add some sort of functionality for managing multiple keys. Sort of like what is describe here : .Sp http://aaronland.net/weblog/archive/4204 .Sp This will probably happen around the time Hell freezes over so if you think you can do it faster, go nuts. .SH "BUGS" .IX Header "BUGS" Please report all bugs via http://rt.cpan.org .SH "LICENSE" .IX Header "LICENSE" Copyright (c) 2002\-2005, Aaron Straup Cope. All Rights Reserved. .PP This is free software, you may use it and distribute it under the same terms as Perl itself.