• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/Net/H20-Jan-2006-2,451734

t/H20-Jan-2006-181119

Build.PLH A D20-Jan-20061.1 KiB3727

ChangesH A D20-Jan-20066.3 KiB239143

MANIFESTH A D20-Jan-2006324 1918

META.ymlH A D20-Jan-2006897 4039

Makefile.PLH A D03-May-20221.1 KiB3222

READMEH A D20-Jan-20066.4 KiB288172

README

1NAME
2    Net::Google - simple OOP-ish interface to the Google SOAP API
3
4SYNOPSIS
5     use Net::Google;
6     use constant LOCAL_GOOGLE_KEY => "********************************";
7
8     my $google = Net::Google->new(key=>LOCAL_GOOGLE_KEY);
9     my $search = $google->search();
10
11     # Search interface
12
13     $search->query(qw(aaron straup cope));
14     $search->lr(qw(en fr));
15     $search->starts_at(5);
16     $search->max_results(15);
17
18     map { print $_->title()."\n"; } @{$search->results()};
19
20     # or...
21
22     foreach my $r (@{$search->response()}) {
23       print "Search time :".$r->searchTime()."\n";
24
25       # returns an array ref of Result objects
26       # the same as the $search->results() method
27       map { print $_->URL()."\n"; } @{$r->resultElements()};
28     }
29
30     # Spelling interface
31
32     print $google->spelling(phrase=>"muntreal qwebec")->suggest(),"\n";
33
34     # Cache interface
35
36     my $cache = $google->cache(url=>"http://search.cpan.org/recent");
37     print $cache->get();
38
39DESCRIPTION
40    Provides a simple OOP-ish interface to the Google SOAP API
41
42ENCODING
43    According to the Google API docs :
44
45     "In order to support searching documents in multiple languages
46     and character encodings the Google Web APIs perform all requests
47     and responses in the UTF-8 encoding. The parameters <ie> and
48     <oe> are required in client requests but their values are ignored.
49     Clients should encode all request data in UTF-8 and should expect
50     results to be in UTF-8."
51
52    (This package takes care of setting both parameters in requests.)
53
54PACKAGE METHODS
55  __PACKAGE__->new(\%args)
56    Valid arguments are :
57
58    *   key
59
60        *string*. A Google API key.
61
62    *   http_proxy
63
64        *url*. A URL for proxy-ing HTTP requests.
65
66    *   debug
67
68        Valid options are:
69
70        *   *boolean*
71
72            If true prints debugging information returned by SOAP::Lite to
73            STDERR
74
75        *   *coderef*.
76
77            Your own subroutine for munging the debugging information
78            returned by SOAP::Lite.
79
80    Note that prior to version 0.60, arguments were not passed by reference.
81    Versions >= 0.60 are backwards compatible.
82
83    Returns an object. Woot!
84
85OBJECT METHODS
86  $obj->key($string)
87    Get/set the Google API key for this object.
88
89  $obj->http_proxy($url)
90    Get/set the HTTP proxy for this object.
91
92    Returns a string.
93
94  $obj->search(\%args)
95    Valid arguments are :
96
97    *   key
98
99        *string*. A Google API key.
100
101        If none is provided then the key passed to the parent *Net::Google*
102        object will be used.
103
104    *   starts_at
105
106        *int*. First result number to display.
107
108        Default is 0.
109
110    *   max_results
111
112        *int*. Number of results to return.
113
114        Default is 10.
115
116    *   lr
117
118        *string* or *array reference*. Language restrictions.
119
120    *   safe
121
122        *boolean*.
123
124    *   filter
125
126        *boolean*.
127
128    *   http_proxy
129
130        *url*. A URL for proxy-ing HTTP requests.
131
132    *   debug
133
134        Valid options are:
135
136        *   *boolean*
137
138            If true prints debugging information returned by SOAP::Lite to
139            STDERR
140
141        *   *coderef*
142
143            Your own subroutine for munging the debugging information
144            returned by SOAP::Lite.
145
146    Note that prior to version 0.60, arguments were not passed by reference.
147    Versions >= 0.60 are backwards compatible.
148
149    Returns a *Net::Google::Search* object. Woot!
150
151    Returns undef if there was an error.
152
153  $obj->spelling(\%args)
154    Valid arguments are:
155
156    *   key
157
158        *string*. A Google API key.
159
160        If none is provided then the key passed to the parent *Net::Google*
161        object will be used.
162
163    *   phrase
164
165        *string* or *array reference*.
166
167    *   http_proxy
168
169        *url*. A URL for proxy-ing HTTP requests.
170
171    *   debug
172
173        *   boolean
174
175            Prints debugging information returned by SOAP::Lite to STDERR
176
177        *   coderef
178
179            Your own subroutine for munging the debugging information
180            returned by SOAP::Lite.
181
182        If no option is defined then the debug argument passed to the parent
183        *Net::Google* object will be used.
184
185    Note that prior to version 0.60, arguments were not passed by reference.
186    Versions >= 0.60 are backwards compatible.
187
188    Returns a *Net::Google::Spelling* object. Woot!
189
190    Returns undef if there was an error.
191
192  $obj->cache(\%args)
193    Valid arguments are :
194
195    *   key
196
197        String. Google API key.
198
199        If none is provided then the key passed to the parent *Net::Google*
200        object will be used.
201
202    *   url
203
204        *string*
205
206    *   http_proxy
207
208        *url*. A URL for proxy-ing HTTP requests.
209
210    *   debug
211
212        Valid options are:
213
214        *   *boolean*
215
216            If true, prints debugging information returned by SOAP::Lite to
217            STDERR
218
219        *   *coderef*
220
221            Your own subroutine for munging the debugging information
222            returned by SOAP::Lite.
223
224        If no option is defined then the debug argument passed to the parent
225        *Net::Google* object will be used.
226
227    Note that prior to version 0.60, arguments were not passed by reference.
228    Versions >= 0.60 are backwards compatible.
229
230    Returns a *Net::Google::Cache* object. Woot!
231
232    Returns undef if there was an error.
233
234  $obj->queries_exhausted()
235    Returns true or false depending on whether or not the current in-memory
236    session has exhausted the Google API 1000 query limit.
237
238VERSION
239    1.0
240
241DATE
242    $Date: 2006/01/12 03:37:31 $
243
244AUTHOR
245    Aaron Straup Cope
246
247CONTRIBUTORS
248    Marc Hedlund <marc@precipice.org>
249
250SEE ALSO
251    http://www.google.com/apis
252
253    Net::Google::Search
254
255    Net::Google::Spelling
256
257    Net::Google::Cache
258
259    Net::Google::Response
260
261    Net::Google::Service
262
263    http://aaronland.info/weblog/archive/4231
264
265TO DO
266    *   Tickle the tests so that they will pass on systems without
267        Test::More.
268
269    *   Add tests for filters.
270
271    *   Add some sort of functionality for managing multiple keys. Sort of
272        like what is describe here :
273
274        http://aaronland.net/weblog/archive/4204
275
276        This will probably happen around the time Hell freezes over so if
277        you think you can do it faster, go nuts.
278
279BUGS
280    Please report all bugs via http://rt.cpan.org
281
282LICENSE
283    Copyright (c) 2002-2005, Aaron Straup Cope. All Rights Reserved.
284
285    This is free software, you may use it and distribute it under the same
286    terms as Perl itself.
287
288