line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Search.pm 9 2008-04-29 21:17:12Z esobchenko $ |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package REST::Google::Search; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
27608
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
79
|
|
7
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
54
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1263
|
use version; our $VERSION = qv('1.0.8'); |
|
2
|
|
|
|
|
2250
|
|
|
2
|
|
|
|
|
15
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use constant { |
12
|
2
|
|
|
|
|
368
|
WEB => 'http://ajax.googleapis.com/ajax/services/search/web', |
13
|
|
|
|
|
|
|
VIDEO => 'http://ajax.googleapis.com/ajax/services/search/video', |
14
|
|
|
|
|
|
|
NEWS => 'http://ajax.googleapis.com/ajax/services/search/news', |
15
|
|
|
|
|
|
|
LOCAL => 'http://ajax.googleapis.com/ajax/services/search/local', |
16
|
|
|
|
|
|
|
IMAGES => 'http://ajax.googleapis.com/ajax/services/search/images', |
17
|
|
|
|
|
|
|
BOOKS => 'http://ajax.googleapis.com/ajax/services/search/books', |
18
|
|
|
|
|
|
|
BLOGS => 'http://ajax.googleapis.com/ajax/services/search/blogs', |
19
|
|
|
|
|
|
|
PATENT => 'http://ajax.googleapis.com/ajax/services/search/patent', |
20
|
2
|
|
|
2
|
|
261
|
}; |
|
2
|
|
|
|
|
3
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
require Exporter; |
23
|
|
|
|
|
|
|
require REST::Google; |
24
|
2
|
|
|
2
|
|
13
|
use base qw/Exporter REST::Google/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
6968
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our @EXPORT_OK = qw/WEB VIDEO NEWS LOCAL IMAGES BOOKS BLOGS PATENT/; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__PACKAGE__->service( WEB ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub responseData { |
31
|
2
|
|
|
2
|
1
|
5438
|
my $self = shift; |
32
|
2
|
50
|
|
|
|
18
|
return undef unless defined $self->{responseData}; |
33
|
2
|
|
|
|
|
17
|
return bless $self->{responseData}, 'REST::Google::Search::Data'; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
package # hide from CPAN |
37
|
|
|
|
|
|
|
REST::Google::Search::Data; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub results { |
40
|
5
|
|
|
5
|
|
3193
|
my $self = shift; |
41
|
5
|
100
|
|
|
|
15
|
if ( wantarray ) { |
42
|
1
|
|
|
|
|
4
|
return map { bless $_, $_->{GsearchResultClass} } @{ $self->{results} }; |
|
4
|
|
|
|
|
18
|
|
|
1
|
|
|
|
|
5
|
|
43
|
|
|
|
|
|
|
} |
44
|
4
|
|
|
|
|
6
|
[ map { bless $_, $_->{GsearchResultClass} } @{ $self->{results} } ]; |
|
16
|
|
|
|
|
51
|
|
|
4
|
|
|
|
|
9
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub cursor { |
48
|
2
|
|
|
2
|
|
1276
|
my $self = shift; |
49
|
2
|
|
|
|
|
22
|
return bless $self->{cursor}, 'REST::Google::Search::Cursor'; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
package # hide from CPAN |
53
|
|
|
|
|
|
|
REST::Google::Search::Cursor; |
54
|
|
|
|
|
|
|
|
55
|
2
|
|
|
2
|
|
13
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
498
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
{ |
58
|
|
|
|
|
|
|
my @fields = qw( |
59
|
|
|
|
|
|
|
moreResultsUrl |
60
|
|
|
|
|
|
|
currentPageIndex |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @fields ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub estimatedResultCount { |
67
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
68
|
0
|
|
|
|
|
0
|
my $count = $self->{estimatedResultCount}; |
69
|
0
|
0
|
|
|
|
0
|
defined $count ? $count : 0; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub pages { |
73
|
2
|
|
|
2
|
|
917
|
my $self = shift; |
74
|
2
|
|
100
|
|
|
24
|
my $pages = $self->{pages} || []; |
75
|
2
|
50
|
|
|
|
12
|
if (wantarray) { |
76
|
0
|
|
|
|
|
0
|
return map { bless $_, 'REST::Google::Search::Pages' } @{ $pages }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
77
|
|
|
|
|
|
|
} |
78
|
2
|
|
|
|
|
5
|
[ map { bless $_, 'REST::Google::Search::Pages' } @{ $pages } ]; |
|
8
|
|
|
|
|
25
|
|
|
2
|
|
|
|
|
8
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
package # hide from CPAN |
82
|
|
|
|
|
|
|
REST::Google::Search::Pages; |
83
|
|
|
|
|
|
|
|
84
|
2
|
|
|
2
|
|
11
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
194
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
{ |
87
|
|
|
|
|
|
|
my @fields = qw( |
88
|
|
|
|
|
|
|
start |
89
|
|
|
|
|
|
|
label |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @fields ); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# |
96
|
|
|
|
|
|
|
# Search Result Classes |
97
|
|
|
|
|
|
|
# |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
package # hide from CPAN |
100
|
|
|
|
|
|
|
GwebSearch; |
101
|
|
|
|
|
|
|
|
102
|
2
|
|
|
2
|
|
96
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
247
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
{ |
105
|
|
|
|
|
|
|
my @fields = qw( |
106
|
|
|
|
|
|
|
unescapedUrl |
107
|
|
|
|
|
|
|
url |
108
|
|
|
|
|
|
|
visibleUrl |
109
|
|
|
|
|
|
|
title |
110
|
|
|
|
|
|
|
titleNoFormatting |
111
|
|
|
|
|
|
|
content |
112
|
|
|
|
|
|
|
cacheUrl |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @fields ); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
package # hide from CPAN |
119
|
|
|
|
|
|
|
GvideoSearch; |
120
|
|
|
|
|
|
|
|
121
|
2
|
|
|
2
|
|
9
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
213
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
{ |
124
|
|
|
|
|
|
|
my @fields = qw( |
125
|
|
|
|
|
|
|
title |
126
|
|
|
|
|
|
|
titleNoFormatting |
127
|
|
|
|
|
|
|
content |
128
|
|
|
|
|
|
|
url |
129
|
|
|
|
|
|
|
published |
130
|
|
|
|
|
|
|
publisher |
131
|
|
|
|
|
|
|
duration |
132
|
|
|
|
|
|
|
tbWidth |
133
|
|
|
|
|
|
|
tbHeight |
134
|
|
|
|
|
|
|
tbUrl |
135
|
|
|
|
|
|
|
playUrl |
136
|
|
|
|
|
|
|
author |
137
|
|
|
|
|
|
|
viewCount |
138
|
|
|
|
|
|
|
rating |
139
|
|
|
|
|
|
|
); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @fields ); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
package # hide from CPAN |
145
|
|
|
|
|
|
|
GnewsSearch; |
146
|
|
|
|
|
|
|
|
147
|
2
|
|
|
2
|
|
11
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1241
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
{ |
150
|
|
|
|
|
|
|
my @fields = qw( |
151
|
|
|
|
|
|
|
title |
152
|
|
|
|
|
|
|
titleNoFormatting |
153
|
|
|
|
|
|
|
unescapedUrl |
154
|
|
|
|
|
|
|
url |
155
|
|
|
|
|
|
|
clusterUrl |
156
|
|
|
|
|
|
|
content |
157
|
|
|
|
|
|
|
publisher |
158
|
|
|
|
|
|
|
location |
159
|
|
|
|
|
|
|
publishedDate |
160
|
|
|
|
|
|
|
relatedStories |
161
|
|
|
|
|
|
|
image |
162
|
|
|
|
|
|
|
language |
163
|
|
|
|
|
|
|
); |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @fields ); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
package # hide from CPAN |
169
|
|
|
|
|
|
|
GlocalSearch; |
170
|
|
|
|
|
|
|
|
171
|
2
|
|
|
2
|
|
11
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
218
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
{ |
174
|
|
|
|
|
|
|
my @fields = qw( |
175
|
|
|
|
|
|
|
title |
176
|
|
|
|
|
|
|
titleNoFormatting |
177
|
|
|
|
|
|
|
url |
178
|
|
|
|
|
|
|
lat |
179
|
|
|
|
|
|
|
lng |
180
|
|
|
|
|
|
|
streetAddress |
181
|
|
|
|
|
|
|
city |
182
|
|
|
|
|
|
|
region |
183
|
|
|
|
|
|
|
country |
184
|
|
|
|
|
|
|
phoneNumbers |
185
|
|
|
|
|
|
|
addressLines |
186
|
|
|
|
|
|
|
ddUrl |
187
|
|
|
|
|
|
|
ddUrlToHere |
188
|
|
|
|
|
|
|
ddUrlFromHere |
189
|
|
|
|
|
|
|
staticMapUrl |
190
|
|
|
|
|
|
|
listingType |
191
|
|
|
|
|
|
|
content |
192
|
|
|
|
|
|
|
); |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @fields ); |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
package # hide from CPAN |
198
|
|
|
|
|
|
|
GimageSearch; |
199
|
|
|
|
|
|
|
|
200
|
2
|
|
|
2
|
|
9
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
324
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
{ |
203
|
|
|
|
|
|
|
my @fields = qw( |
204
|
|
|
|
|
|
|
title |
205
|
|
|
|
|
|
|
titleNoFormatting |
206
|
|
|
|
|
|
|
unescapedUrl |
207
|
|
|
|
|
|
|
url |
208
|
|
|
|
|
|
|
visibleUrl |
209
|
|
|
|
|
|
|
originalContextUrl |
210
|
|
|
|
|
|
|
width |
211
|
|
|
|
|
|
|
height |
212
|
|
|
|
|
|
|
tbWidth |
213
|
|
|
|
|
|
|
tbHeight |
214
|
|
|
|
|
|
|
tbUrl |
215
|
|
|
|
|
|
|
content |
216
|
|
|
|
|
|
|
contentNoFormatting |
217
|
|
|
|
|
|
|
); |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @fields ); |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
package # hide from CPAN |
223
|
|
|
|
|
|
|
GbookSearch; |
224
|
|
|
|
|
|
|
|
225
|
2
|
|
|
2
|
|
10
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
190
|
|
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
{ |
228
|
|
|
|
|
|
|
my @fields = qw( |
229
|
|
|
|
|
|
|
title |
230
|
|
|
|
|
|
|
titleNoFormatting |
231
|
|
|
|
|
|
|
unescapedUrl |
232
|
|
|
|
|
|
|
url |
233
|
|
|
|
|
|
|
authors |
234
|
|
|
|
|
|
|
bookId |
235
|
|
|
|
|
|
|
publishedYear |
236
|
|
|
|
|
|
|
pageCount |
237
|
|
|
|
|
|
|
thumbnailHtml |
238
|
|
|
|
|
|
|
); |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @fields ); |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
package # hide from CPAN |
244
|
|
|
|
|
|
|
GblogSearch; |
245
|
|
|
|
|
|
|
|
246
|
2
|
|
|
2
|
|
9
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
197
|
|
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
{ |
249
|
|
|
|
|
|
|
my @fields = qw( |
250
|
|
|
|
|
|
|
title |
251
|
|
|
|
|
|
|
titleNoFormatting |
252
|
|
|
|
|
|
|
postUrl |
253
|
|
|
|
|
|
|
content |
254
|
|
|
|
|
|
|
author |
255
|
|
|
|
|
|
|
blogUrl |
256
|
|
|
|
|
|
|
publishedDate |
257
|
|
|
|
|
|
|
); |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @fields ); |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
package # hide from CPAN |
263
|
|
|
|
|
|
|
GpatentSearch; |
264
|
|
|
|
|
|
|
|
265
|
2
|
|
|
2
|
|
10
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
225
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
{ |
268
|
|
|
|
|
|
|
my @fields = qw( |
269
|
|
|
|
|
|
|
title |
270
|
|
|
|
|
|
|
titleNoFormatting |
271
|
|
|
|
|
|
|
content |
272
|
|
|
|
|
|
|
unescapedUrl |
273
|
|
|
|
|
|
|
url |
274
|
|
|
|
|
|
|
applicationDate |
275
|
|
|
|
|
|
|
patentNumber |
276
|
|
|
|
|
|
|
patentStatus |
277
|
|
|
|
|
|
|
assignee |
278
|
|
|
|
|
|
|
tbUrl |
279
|
|
|
|
|
|
|
); |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( @fields ); |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
1; |