| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
{ |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::Google - simple OOP-ish interface to the Google SOAP API |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Net::Google; |
|
10
|
|
|
|
|
|
|
use constant LOCAL_GOOGLE_KEY => "********************************"; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $google = Net::Google->new(key=>LOCAL_GOOGLE_KEY); |
|
13
|
|
|
|
|
|
|
my $search = $google->search(); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Search interface |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$search->query(qw(aaron straup cope)); |
|
18
|
|
|
|
|
|
|
$search->lr(qw(en fr)); |
|
19
|
|
|
|
|
|
|
$search->starts_at(5); |
|
20
|
|
|
|
|
|
|
$search->max_results(15); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
map { print $_->title()."\n"; } @{$search->results()}; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# or... |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
foreach my $r (@{$search->response()}) { |
|
27
|
|
|
|
|
|
|
print "Search time :".$r->searchTime()."\n"; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# returns an array ref of Result objects |
|
30
|
|
|
|
|
|
|
# the same as the $search->results() method |
|
31
|
|
|
|
|
|
|
map { print $_->URL()."\n"; } @{$r->resultElements()}; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Spelling interface |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
print $google->spelling(phrase=>"muntreal qwebec")->suggest(),"\n"; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Cache interface |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $cache = $google->cache(url=>"http://search.cpan.org/recent"); |
|
41
|
|
|
|
|
|
|
print $cache->get(); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Provides a simple OOP-ish interface to the Google SOAP API |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 ENCODING |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
According to the Google API docs : |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
"In order to support searching documents in multiple languages |
|
52
|
|
|
|
|
|
|
and character encodings the Google Web APIs perform all requests |
|
53
|
|
|
|
|
|
|
and responses in the UTF-8 encoding. The parameters and |
|
54
|
|
|
|
|
|
|
are required in client requests but their values are ignored. |
|
55
|
|
|
|
|
|
|
Clients should encode all request data in UTF-8 and should expect |
|
56
|
|
|
|
|
|
|
results to be in UTF-8." |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
(This package takes care of setting both parameters in requests.) |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
|
61
|
|
|
|
|
|
|
|
|
62
|
3
|
|
|
3
|
|
8553
|
use strict; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
188
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
package Net::Google; |
|
65
|
3
|
|
|
3
|
|
16
|
use base qw (Net::Google::tool); |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
1778
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
3
|
|
|
3
|
|
23
|
use Carp; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
4250
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
$Net::Google::VERSION = '1.0'; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
$Net::Google::QUERY_LIMIT = 1000; |
|
72
|
|
|
|
|
|
|
$Net::Google::KEY_QUERIES = {}; |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 PACKAGE METHODS |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 __PACKAGE__->new(\%args) |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Valid arguments are : |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=over 4 |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
B |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
I. A Google API key. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
B |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
I. A URL for proxy-ing HTTP requests. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
B |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Valid options are: |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 4 |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
I |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
If true prints debugging information returned by SOAP::Lite |
|
109
|
|
|
|
|
|
|
to STDERR |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
I. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Your own subroutine for munging the debugging information |
|
116
|
|
|
|
|
|
|
returned by SOAP::Lite. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=back |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Note that prior to version 0.60, arguments were not passed |
|
123
|
|
|
|
|
|
|
by reference. Versions >= 0.60 are backwards compatible. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Returns an object. Woot! |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub new { |
|
130
|
3
|
|
|
3
|
1
|
1823
|
my $pkg = shift; |
|
131
|
|
|
|
|
|
|
|
|
132
|
3
|
|
|
|
|
9
|
my $self = {}; |
|
133
|
3
|
|
|
|
|
10
|
bless $self,$pkg; |
|
134
|
|
|
|
|
|
|
|
|
135
|
3
|
50
|
|
|
|
11
|
if (! $self->init(@_)) { |
|
136
|
0
|
|
|
|
|
0
|
return undef; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
3
|
|
|
|
|
11
|
return $self; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub init { |
|
143
|
3
|
|
|
3
|
0
|
6
|
my $self = shift; |
|
144
|
3
|
50
|
|
|
|
26
|
my $args = (ref($_[0]) eq "HASH") ? shift : {@_}; |
|
145
|
|
|
|
|
|
|
|
|
146
|
3
|
|
|
|
|
28
|
$self->{'_debug'} = $args->{'debug'}; |
|
147
|
3
|
|
|
|
|
8
|
$self->{'_key'} = $args->{'key'}; |
|
148
|
3
|
|
|
|
|
8
|
$self->{'_http_proxy'} = $args->{'http_proxy'}; |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# Do *not* call parent |
|
151
|
|
|
|
|
|
|
# class' init() method. |
|
152
|
|
|
|
|
|
|
|
|
153
|
3
|
|
|
|
|
18
|
return 1; |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 $obj->key($string) |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Get/set the Google API key for this object. |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
# Defined in Net::Google::tool |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 $obj->http_proxy($url) |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Get/set the HTTP proxy for this object. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Returns a string. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=cut |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
# Note we subclass the method normally inherited |
|
177
|
|
|
|
|
|
|
# from ::tool.pm. Since this is just a wrapper |
|
178
|
|
|
|
|
|
|
# module, we don't have a SOAP thingy to actually |
|
179
|
|
|
|
|
|
|
# set the proxy for so we'll just cache it for |
|
180
|
|
|
|
|
|
|
# later. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub http_proxy { |
|
183
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
184
|
0
|
|
|
|
|
0
|
my $uri = shift; |
|
185
|
|
|
|
|
|
|
|
|
186
|
0
|
0
|
|
|
|
0
|
if ($uri) { |
|
187
|
0
|
|
|
|
|
0
|
$self->{'_http_proxy'} = $uri; |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
0
|
return $self->{'_http_proxy'}; |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 $obj->search(\%args) |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Valid arguments are : |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=over 4 |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item * |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
B |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
I. A Google API key. |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
If none is provided then the key passed to the parent |
|
206
|
|
|
|
|
|
|
I object will be used. |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
B |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
I. First result number to display. |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Default is 0. |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item * |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
B |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
I. Number of results to return. |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
Default is 10. |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=item * |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
B |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
I or I. Language restrictions. |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=item * |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
B |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
I. |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item * |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
B |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
I. |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=item * |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
B |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
I. A URL for proxy-ing HTTP requests. |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=item * |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
B |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Valid options are: |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=over 4 |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=item * |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
I |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
If true prints debugging information returned by SOAP::Lite |
|
262
|
|
|
|
|
|
|
to STDERR |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=item * |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
I |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Your own subroutine for munging the debugging information |
|
269
|
|
|
|
|
|
|
returned by SOAP::Lite. |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=back |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=back |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
Note that prior to version 0.60, arguments were not passed |
|
276
|
|
|
|
|
|
|
by reference. Versions >= 0.60 are backwards compatible. |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
Returns a I object. Woot! |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
Returns undef if there was an error. |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=cut |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub search { |
|
285
|
1
|
|
|
1
|
1
|
324
|
my $self = shift; |
|
286
|
1
|
|
|
|
|
522
|
require Net::Google::Search; |
|
287
|
1
|
|
|
|
|
5
|
return Net::Google::Search->new($self->_parse_args(@_)); |
|
288
|
|
|
|
|
|
|
} |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=head2 $obj->spelling(\%args) |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
Valid arguments are: |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=over 4 |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=item * |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
B |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
I. A Google API key. |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
If none is provided then the key passed to the parent |
|
303
|
|
|
|
|
|
|
I object will be used. |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=item * |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
B |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
I or I. |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=item * |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
B |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
I. A URL for proxy-ing HTTP requests. |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=item * |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
B |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=over 4 |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=item * |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
B |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
Prints debugging information returned by SOAP::Lite to STDERR |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=item * |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
B |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
Your own subroutine for munging the debugging information |
|
334
|
|
|
|
|
|
|
returned by SOAP::Lite. |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=back |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
If no option is defined then the debug argument passed to the parent |
|
339
|
|
|
|
|
|
|
I object will be used. |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=back |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
Note that prior to version 0.60, arguments were not passed |
|
344
|
|
|
|
|
|
|
by reference. Versions >= 0.60 are backwards compatible. |
|
345
|
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
Returns a I object. Woot! |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
Returns undef if there was an error. |
|
349
|
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
=cut |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
sub spelling { |
|
353
|
1
|
|
|
1
|
1
|
492
|
my $self = shift; |
|
354
|
1
|
|
|
|
|
702
|
require Net::Google::Spelling; |
|
355
|
1
|
|
|
|
|
6
|
return Net::Google::Spelling->new($self->_parse_args(@_)); |
|
356
|
|
|
|
|
|
|
} |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
# Small things are good because you can |
|
359
|
|
|
|
|
|
|
# fit them in your hand *and* your mouth. |
|
360
|
|
|
|
|
|
|
|
|
361
|
0
|
|
|
0
|
0
|
0
|
sub speling { return shift->spelling(@_); } |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=head2 $obj->cache(\%args) |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
Valid arguments are : |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=over 4 |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=item * |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
B |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
String. Google API key. |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
If none is provided then the key passed to the parent I |
|
376
|
|
|
|
|
|
|
object will be used. |
|
377
|
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
=item * |
|
379
|
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
B |
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
I |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=item * |
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
B |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
I. A URL for proxy-ing HTTP requests. |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
=item * |
|
391
|
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
B |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
Valid options are: |
|
395
|
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
=over 4 |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
=item * |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
I |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
If true, prints debugging information returned by SOAP::Lite |
|
403
|
|
|
|
|
|
|
to STDERR |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=item * |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
I |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
Your own subroutine for munging the debugging information |
|
410
|
|
|
|
|
|
|
returned by SOAP::Lite. |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=back |
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
If no option is defined then the debug argument passed to the parent |
|
415
|
|
|
|
|
|
|
I object will be used. |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=back |
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
Note that prior to version 0.60, arguments were not passed |
|
420
|
|
|
|
|
|
|
by reference. Versions >= 0.60 are backwards compatible. |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
Returns a I object. Woot! |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
Returns undef if there was an error. |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
=cut |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
sub cache { |
|
429
|
1
|
|
|
1
|
1
|
485
|
my $self = shift; |
|
430
|
1
|
|
|
|
|
657
|
require Net::Google::Cache; |
|
431
|
1
|
|
|
|
|
6
|
return Net::Google::Cache->new($self->_parse_args(@_)); |
|
432
|
|
|
|
|
|
|
} |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
=head2 $obj->queries_exhausted() |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
Returns true or false depending on whether or not the current in-memory |
|
437
|
|
|
|
|
|
|
B has exhausted the Google API 1000 query limit. |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=cut |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
# Defined in Net::Google::tool |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
# |
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
sub _parse_args { |
|
446
|
3
|
|
|
3
|
|
7
|
my $self = shift; |
|
447
|
3
|
50
|
|
|
|
14
|
my $args = (ref($_[0]) eq "HASH") ? shift : {@_}; |
|
448
|
|
|
|
|
|
|
|
|
449
|
3
|
|
|
|
|
9
|
foreach my $el ("key","debug","http_proxy") { |
|
450
|
9
|
50
|
|
|
|
27
|
next if (defined($args->{$el})); |
|
451
|
9
|
|
|
|
|
44
|
$args->{$el} = $self->{"_$el"}; |
|
452
|
|
|
|
|
|
|
} |
|
453
|
|
|
|
|
|
|
|
|
454
|
3
|
|
|
|
|
18
|
return $args; |
|
455
|
|
|
|
|
|
|
} |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=head1 VERSION |
|
458
|
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
1.0 |
|
460
|
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=head1 DATE |
|
462
|
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
$Date: 2005/03/26 20:49:03 $ |
|
464
|
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
=head1 AUTHOR |
|
466
|
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
Aaron Straup Cope |
|
468
|
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
Marc Hedlund |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
http://www.google.com/apis |
|
476
|
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
L |
|
478
|
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
L |
|
480
|
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
L |
|
482
|
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
L |
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
L |
|
486
|
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
http://aaronland.info/weblog/archive/4231 |
|
488
|
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
=head1 TO DO |
|
490
|
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
=over 4 |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
=item * |
|
494
|
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
Tickle the tests so that they will pass on systems without |
|
496
|
|
|
|
|
|
|
Test::More. |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=item * |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
Add tests for filters. |
|
501
|
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
=item * |
|
503
|
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
Add some sort of functionality for managing multiple keys. |
|
505
|
|
|
|
|
|
|
Sort of like what is describe here : |
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
http://aaronland.net/weblog/archive/4204 |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
This will probably happen around the time Hell freezes over |
|
510
|
|
|
|
|
|
|
so if you think you can do it faster, go nuts. |
|
511
|
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
=back |
|
513
|
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
=head1 BUGS |
|
515
|
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
Please report all bugs via http://rt.cpan.org |
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
=head1 LICENSE |
|
519
|
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
Copyright (c) 2002-2005, Aaron Straup Cope. All Rights Reserved. |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
This is free software, you may use it and distribute it under the |
|
523
|
|
|
|
|
|
|
same terms as Perl itself. |
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=cut |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
return 1; |
|
528
|
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
} |