| 1 | { | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | =head1 NAME | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | Net::Google::Search - simple OOP-ish interface to the Google SOAP API for searching | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | use Net::Google::Search; | ||||||||||||||||||||||||||||
| 10 | my $search = Net::Google::Search->new(\%args); | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | $search->query(qw(aaron cope)); | ||||||||||||||||||||||||||||
| 13 | map { print $_->title()."\n"; } @{$search->results()}; | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | # or | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | foreach my $r (@{$search->response()}) { | ||||||||||||||||||||||||||||
| 18 | print "Search time :".$r->searchTime()."\n"; | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # returns an array ref of Result objects | ||||||||||||||||||||||||||||
| 21 | # the same as the $search->results() method | ||||||||||||||||||||||||||||
| 22 | map { print $_->URL()."\n"; } @{$r->resultElement()} | ||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | Provides a simple OOP-ish interface to the Google SOAP API | ||||||||||||||||||||||||||||
| 28 | for searching. | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | This package is used by I<Net::Google>. | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =head1 ENCODING | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | According to the Google API docs : | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | "In order to support searching documents in multiple languages | ||||||||||||||||||||||||||||
| 37 | and character encodings the Google Web APIs perform all requests | ||||||||||||||||||||||||||||
| 38 | and responses in the UTF-8 encoding. The parameters <ie> and | ||||||||||||||||||||||||||||
| 39 | <oe> are required in client requests but their values are ignored. | ||||||||||||||||||||||||||||
| 40 | Clients should encode all request data in UTF-8 and should expect | ||||||||||||||||||||||||||||
| 41 | results to be in UTF-8." | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | (This package takes care of setting both parameters in requests.) | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =cut | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | package Net::Google::Search; | ||||||||||||||||||||||||||||
| 50 | 1 | ▶ | use base qw (Net::Google::tool); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 53 | 1 | ▶ | use Net::Google::Response; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 1 | $Net::Google::Search::VERSION = '1.0'; | |||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 1 | ▶ | use constant RESTRICT_ENCODING => qw [ arabic gb big5 latin1 latin2 latin3 latin4 latin5 latin6 greek hebrew sjis euc-jp euc-kr cyrillic utf8 ]; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 1 | ▶ | use constant RESTRICT_LANGUAGES => qw [ ar zh-CN zh-TW cs da nl en et fi fr de el iw hu is it ja ko lv lt no pt pl ro ru es sv tr ]; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 1 | ▶ | use constant RESTRICT_COUNTRIES => qw [ AD AE AF AG AI AL AM AN AO AQ AR AS AT AU AW AZ BA BB BD BE BF BG BH BI BJ BM BN BO BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CN CO CR CU CV CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET EU FI FJ FK FM FO FR FX GA GD GE GF GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IO IQ IR IS IT JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI ML NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR ST SV SY SZ TC TD TF TG TH TJ TK TM TN TO TP TR TT TV TW TZ UA UG UK UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT YU ZA ZM ZR ]; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 1 | ▶ | use constant RESTRICT_TOPICS => qw [ unclesam linux mac bsd ]; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 1 | ▶ | use constant WATCH => "__estimatedTotalResultsCount"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =head1 PACKAGE METHODS | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =cut | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =head2 __PACKAGE__->new(\%args) | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | Valid arguments are : | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =over 4 | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =item * | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | B<key> | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | I<string>. A Google API key. | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | If none is provided then the key passed to the parent I<Net::Google> | ||||||||||||||||||||||||||||
| 84 | object will be used. | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =item * | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | B<starts_at> | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | I<int>. First result number to display. | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | Default is 0. | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | =item * | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | B<max_results> | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | I<int>. Number of results to return. | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | Default is 10. | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | =item * | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | B<lr> | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | I<string> or I<array reference>. Language restrictions. | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | =item * | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | B<safe> | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | I<boolean>. | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | =item * | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | B<filter> | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | I<boolean>. | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | =item * | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | B<http_proxy> | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | I<url>. A URL for proxy-ing HTTP requests. | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | =item * | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | B<debug> | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | Valid options are: | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | =over 4 | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | =item * | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | I<boolean> | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | If true prints debugging information returned by SOAP::Lite | ||||||||||||||||||||||||||||
| 139 | to STDERR | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | =item * | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | I<coderef>. | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | Your own subroutine for munging the debugging information | ||||||||||||||||||||||||||||
| 146 | returned by SOAP::Lite. | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | =back | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | =back | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | The object constructor in Net::Google 0.53, and earlier, expected | ||||||||||||||||||||||||||||
| 153 | a I<GoogleSearchService> object as its first argument followed by | ||||||||||||||||||||||||||||
| 154 | a hash reference of argument. Versions 0.6 and higher are backwards | ||||||||||||||||||||||||||||
| 155 | compatible. | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | Returns an object. Woot! | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =cut | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=9.2
Pod
documented
| |||||||||||||||||||||||||||||
| 162 | 1 | my $pkg = shift; | |||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 1 | my $self = {}; | |||||||||||||||||||||||||||
| 165 | 1 | bless $self,$pkg; | |||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 1 | ▶ | if (! $self->init("search",@_)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 168 | 0 | return undef; | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 0 | return $self; | |||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 1 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=18 SCAR=57.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 175 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 1 | ▶ | my $args = $self->SUPER::init(@_) | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->SUPER::init(@_) || (return 0)
MC/DC0%0/1
$self->SUPER::init(@_) || (return 0)
$self->SUPER::init(@_)
Truth table0%0/2
A
A= $self->SUPER::init(@_)
| |||||||||||||||||||||||||||||
| 178 | || return 0; | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | # | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | $self->{'_query'} = []; | |||||||||||||||||||||||||||
| 183 | 0 | $self->{'_lr'} = []; | |||||||||||||||||||||||||||
| 184 | 0 | $self->{'_restrict'} = []; | |||||||||||||||||||||||||||
| 185 | 0 | $self->{'_safe'} = 0; | |||||||||||||||||||||||||||
| 186 | 0 | $self->{'_filter'} = 0; | |||||||||||||||||||||||||||
| 187 | 0 | $self->{'_starts_at'} = 0; | |||||||||||||||||||||||||||
| 188 | 0 | $self->{'_max_results'} = 10; | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 0 | ▶ | $self->starts_at(($args->{'starts_at'} || 0)); | ||||||||||||||||||||||||||
|
Condition0%0/2
$args->{'starts_at'} || 0
MC/DC0%0/1
$args->{'starts_at'} || 0
$args->{'starts_at'}
Truth table0%0/2
A
A= $args->{'starts_at'}
| |||||||||||||||||||||||||||||
| 191 | 0 | ▶ | $self->max_results(($args->{'max_results'}) || 10); | ||||||||||||||||||||||||||
|
Condition0%0/2
$args->{'max_results'} || 10
MC/DC0%0/1
$args->{'max_results'} || 10
$args->{'max_results'}
Truth table0%0/2
A
A= $args->{'max_results'}
| |||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ($args->{lr}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 194 | 0 | ▶ | defined($self->lr( ((ref($args->{'lr'}) eq "ARRAY") ? @{$args->{'lr'}} : $args->{'lr'}) )) || return 0; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 0 | ▶ | if ($args->{restrict}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 198 | 0 | ▶ | defined($self->restrict( ((ref($args->{'restrict'}) eq "ARRAY") ? @{$args->{'restrict'}} : $args->{'restrict'}) )) || return 0; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if (defined($args->{'filter'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 202 | 0 | ▶ | defined($self->filter($args->{'filter'})) || return 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 0 | ▶ | if (defined($args->{'safe'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 0 | ▶ | defined($self->safe($args->{'safe'})) || return 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 0 | ▶ | if (defined($args->{'starts_at'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 210 | 0 | ▶ | defined($self->starts_at($args->{'starts_at'})) || return 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 0 | ▶ | if (defined($args->{'max_results'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 0 | ▶ | defined($self->max_results($args->{'max_results'})) || return 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 0 | return 1; | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | =head1 OBJECT METHODS | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | =cut | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | 0 | ▶ | sub ie { | ||||||||||||||||||||||||||
|
Subroutine
ie: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 225 | 0 | carp "The 'ie' method has been deprecated"; | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | sub oe { | ||||||||||||||||||||||||||
|
Subroutine
oe: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 229 | 0 | carp "The 'oe' method has been deprecated"; | |||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | =head2 $obj->key($string) | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | Get/set the Google API key for this object. | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | =cut | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | # Defined in Net::Google::tool | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | =head2 $obj->http_proxy($url) | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | Get/set the HTTP proxy for this object. | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | Returns a string. | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | =cut | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | # Defined in Net::Google::tool | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | =head2 $obj->query(@data) | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | If the first item in I<@data> is empty, then any existing | ||||||||||||||||||||||||||||
| 253 | I<query> data will be removed before the new data is added. | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | Returns a string of words separated by white space. Returns | ||||||||||||||||||||||||||||
| 256 | undef if there was an error. | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | =cut | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 0 | ▶ | sub query { | ||||||||||||||||||||||||||
|
Subroutine
query: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 261 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 262 | 0 | my @data = @_; | |||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | 0 | ▶ | if ((scalar(@data) > 1) && ($data[0] eq "")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @data > 1 and $data[0] eq ""
MC/DC0%0/2
scalar @data > 1 and $data[0] eq ""
scalar @data > 1
$data[0] eq ""
Truth table0%0/3
A and B
A= scalar @data > 1B= $data[0] eq ""
| |||||||||||||||||||||||||||||
| 265 | 0 | $self->{'_query'} = []; | |||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 0 | ▶ | if (@data) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 269 | 0 | push @{$self->{'_query'}}, @data; | |||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | 0 | return join(" ",@{$self->{'_query'}}); | |||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | =head2 $obj->starts_at($at) | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | Returns an int. Default is 0. | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | Returns undef if there was an error. | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | =cut | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | 0 | ▶ | sub starts_at { | ||||||||||||||||||||||||||
|
Subroutine
starts_at: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 284 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 285 | 0 | my $at = shift; | |||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 0 | ▶ | if (defined($at)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 288 | 0 | $self->{'_starts_at'} = $at; | |||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | 0 | return $self->{'_starts_at'}; | |||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | =head2 $obj->max_results($max) | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | The default set by Google is 10 results. However, if | ||||||||||||||||||||||||||||
| 297 | you pass a number greater than 10 the I<results> method | ||||||||||||||||||||||||||||
| 298 | will make multiple calls to Google API. | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | Returns an int. | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | Returns undef if there was an error. | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | =cut | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 0 | ▶ | sub max_results { | ||||||||||||||||||||||||||
|
Subroutine
max_results: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 307 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 308 | 0 | my $max = shift; | |||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | 0 | ▶ | if (defined($max)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | 0 | ▶ | if (int($max) < 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 313 | 0 | carp "'$max' must be a int greater than 0"; | |||||||||||||||||||||||||||
| 314 | 0 | $max = 1; | |||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | 0 | $self->{'_max_results'} = $max; | |||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 0 | return $self->{'_max_results'}; | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | =head2 $obj->restrict(@types) | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | If the first item in I<@types> is empty, then any existing | ||||||||||||||||||||||||||||
| 326 | I<restrict> data will be removed before the new data is | ||||||||||||||||||||||||||||
| 327 | added. | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | Returns a string. Returns undef if there was an error. | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | =cut | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | 0 | ▶ | sub restrict { | ||||||||||||||||||||||||||
|
Subroutine
restrict: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 334 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 335 | 0 | my @types = @_; | |||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | 0 | ▶ | if ((scalar(@types) > 1) && ($types[0] eq "")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @types > 1 and $types[0] eq ""
MC/DC0%0/2
scalar @types > 1 and $types[0] eq ""
scalar @types > 1
$types[0] eq ""
Truth table0%0/3
A and B
A= scalar @types > 1B= $types[0] eq ""
| |||||||||||||||||||||||||||||
| 338 | 0 | $self->{'_restrict'} = []; | |||||||||||||||||||||||||||
| 339 | 0 | shift @types; | |||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | 0 | ▶ | if (@types) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 343 | 0 | push @{$self->{'_restrict'}},@types; | |||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | 0 | return join("",@{$self->{'_restrict'}}); | |||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | =head2 $obj->filter($bool) | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | Returns true or false. Returns undef if there was an error. | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | =cut | ||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | 0 | ▶ | sub filter { | ||||||||||||||||||||||||||
|
Subroutine
filter: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 356 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 357 | 0 | my $bool = shift; | |||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | 0 | ▶ | if (defined($bool)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 361 | 0 | ▶ | $self->{'_filter'} = ($bool) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | 0 | return $self->{'_filter'}; | |||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | =head2 $obj->safe($bool) | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | Returns true or false. Returns undef if there was an error. | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | =cut | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | 0 | ▶ | sub safe { | ||||||||||||||||||||||||||
|
Subroutine
safe: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 374 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 375 | 0 | my $bool = shift; | |||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | 0 | ▶ | if (defined($bool)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 378 | 0 | ▶ | $self->{'_safe'} = ($bool) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | 0 | return $self->{'_safe'}; | |||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | =head2 $obj->lr(@lang) | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | Language restriction. | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | If the first item in I<@lang> is empty, then any existing | ||||||||||||||||||||||||||||
| 389 | I<lr> data will be removed before the new data is added. | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | Returns a string. Returns undef if there was an error. | ||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | =cut | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | 0 | ▶ | sub lr { | ||||||||||||||||||||||||||
|
Subroutine
lr: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 396 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 397 | 0 | my @lang = @_; | |||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | 0 | ▶ | if ((scalar(@lang) > 1) && ($lang[0] eq "")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @lang > 1 and $lang[0] eq ""
MC/DC0%0/2
scalar @lang > 1 and $lang[0] eq ""
scalar @lang > 1
$lang[0] eq ""
Truth table0%0/3
A and B
A= scalar @lang > 1B= $lang[0] eq ""
| |||||||||||||||||||||||||||||
| 400 | 0 | $self->{'_lr'} = []; | |||||||||||||||||||||||||||
| 401 | 0 | shift @lang; | |||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | 0 | ▶ | if (@lang) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 405 | 0 | push @{$self->{'_lr'}},@lang; | |||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | 0 | return join("",@{$self->{'_lr'}}); | |||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | =head2 $obj->return_estimatedTotal($bool) | ||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | Toggle whether or not to return all the results defined by the | ||||||||||||||||||||||||||||
| 414 | '__estimatedTotalResultsCount' key. | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | Default is false. | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | =cut | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | 0 | ▶ | sub return_estimatedTotal { | ||||||||||||||||||||||||||
|
Subroutine
return_estimatedTotal: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 421 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 422 | 0 | my $bool = shift; | |||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | 0 | ▶ | if (defined($bool)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 425 | 0 | ▶ | $self->{'__estimatedTotal'} = ($bool) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | 0 | return $self->{'__estimatedTotal'}; | |||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | =head2 $obj->response() | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | Returns an array ref of I<Net::Google::Response> objects, | ||||||||||||||||||||||||||||
| 434 | from which the search response metadata as well as the | ||||||||||||||||||||||||||||
| 435 | search results may be obtained. | ||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||
| 437 | Use this method if you would like to receive a full response | ||||||||||||||||||||||||||||
| 438 | as documented in the Google Web APIs Reference (the whole | ||||||||||||||||||||||||||||
| 439 | of section 3). | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | =cut | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | 0 | ▶ | sub response { | ||||||||||||||||||||||||||
|
Subroutine
response: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||
| 444 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | 0 | ▶ | if (defined($self->{'__state'}) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"__state"} and $self->{"__state"} eq $self->_state
MC/DC0%0/2
defined $self->{"__state"} and $self->{"__state"} eq $self->_state
defined $self->{"__state"}
$self->{"__state"} eq $self->_state
Truth table0%0/3
A and B
A= defined $self->{"__state"}B= $self->{"__state"} eq $self->_state
| |||||||||||||||||||||||||||||
| 447 | ($self->{'__state'} eq $self->_state())) { | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | 0 | return $self->{'__response'}; | |||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | 0 | $self->{'__response'} = []; | |||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | 0 | my $start_at = $self->starts_at(); | |||||||||||||||||||||||||||
| 455 | 0 | my $to_fetch = $self->max_results(); | |||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | 0 | ▶ | while ($to_fetch > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 458 | 0 | ▶ | my $count = ($to_fetch > 10) ? 10 : $to_fetch; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | # Net::Google::Response will carp | ||||||||||||||||||||||||||||
| 461 | # if there's a problem so we just | ||||||||||||||||||||||||||||
| 462 | # move on if there's a problem. | ||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||
| 464 | 0 | my $res = $self->_response($start_at,$count); | |||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | 0 | ▶ | if (! defined($res)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 467 | 0 | last; | |||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | # | ||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | 0 | ▶ | if ((! $self->return_estimatedTotal()) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->return_estimatedTotal and $start_at >= $res->{"__endIndex"}
MC/DC0%0/2
not $self->return_estimatedTotal and $start_at >= $res->{"__endIndex"}
not $self->return_estimatedTotal
$start_at >= $res->{"__endIndex"}
Truth table0%0/3
not(A) and B
A= not $self->return_estimatedTotalB= $start_at >= $res->{"__endIndex"}
| |||||||||||||||||||||||||||||
| 473 | ($start_at >= $res->{__endIndex})) { | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | 0 | last; | |||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | # | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | 0 | ▶ | if ($self->return_estimatedTotal()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | 0 | ▶ | if (($self->{'__possible'} + scalar(@{$res->resultElements()})) > $res->{'__estimatedTotalResultsCount'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | 0 | my $justright = int($res->{'__estimatedTotalResultsCount'} - $self->{'__possible'}); | |||||||||||||||||||||||||||
| 485 | 0 | @{$res->resultElements()} = @{$res->resultElements()}[0..($justright -1)]; | |||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | 0 | push @{$self->{'__response'}} , $res; | |||||||||||||||||||||||||||
| 488 | 0 | last; | |||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | 0 | $self->{'__possible'} += scalar(@{$res->resultElements()}); | |||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | 0 | ▶ | if (($self->{'__possible'} + scalar(@{$res->resultElements()})) == $res->{'__estimatedTotalResultsCount'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 494 | 0 | last; | |||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||
| 498 | # | ||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | 0 | push @{$self->{'__response'}}, $res; | |||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||
| 502 | 0 | $start_at += 10; | |||||||||||||||||||||||||||
| 503 | 0 | $to_fetch -= 10; | |||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | 0 | return $self->{'__response'}; | |||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||
| 509 | =head2 $obj->results() | ||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||
| 511 | Returns an array ref of I<Result> objects (see docs for | ||||||||||||||||||||||||||||
| 512 | I<Net::Google::Response>), each of which represents one | ||||||||||||||||||||||||||||
| 513 | result from the search. | ||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | Use this method if you don't care about the search response | ||||||||||||||||||||||||||||
| 516 | metadata, and only care about the resources that are found | ||||||||||||||||||||||||||||
| 517 | by the search, as described in section 3.2 of the Google Web | ||||||||||||||||||||||||||||
| 518 | APIs Reference. | ||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||
| 520 | =cut | ||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | 0 | ▶ | sub results { | ||||||||||||||||||||||||||
|
Subroutine
results: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 523 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 524 | 0 | return [ map { @{ $_->resultElements() } } @{$self->response()} ]; | |||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||
| 527 | =head2 $obj->queries_exhausted() | ||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||
| 529 | Returns true or false depending on whether or not the current in-memory | ||||||||||||||||||||||||||||
| 530 | B<session> has exhausted the Google API 1000 query limit. | ||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||
| 532 | =cut | ||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||
| 534 | # Defined in ::tool | ||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||
| 536 | 0 | ▶ | sub _response { | ||||||||||||||||||||||||||
|
Subroutine
_response: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 537 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 538 | 0 | my $first = shift; | |||||||||||||||||||||||||||
| 539 | 0 | my $count = shift; | |||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||
| 541 | 0 | $self->_queries(1); | |||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | my $response = | ||||||||||||||||||||||||||||
| 544 | 0 | ▶ | $self->{'_service'} | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 545 | ->doGoogleSearch( | ||||||||||||||||||||||||||||
| 546 | $self->key(), | ||||||||||||||||||||||||||||
| 547 | $self->query(), | ||||||||||||||||||||||||||||
| 548 | $first, | ||||||||||||||||||||||||||||
| 549 | $count, | ||||||||||||||||||||||||||||
| 550 | SOAP::Data->type(boolean=>($self->filter() | ||||||||||||||||||||||||||||
| 551 | ? "true" : "false")), | ||||||||||||||||||||||||||||
| 552 | # I don't think I should need to | ||||||||||||||||||||||||||||
| 553 | # do this but SOAP::Lite doesn't | ||||||||||||||||||||||||||||
| 554 | # appear to be doing to right thing | ||||||||||||||||||||||||||||
| 555 | # see also : RT bug #6167 | ||||||||||||||||||||||||||||
| 556 | # ? 1 : 0)), | ||||||||||||||||||||||||||||
| 557 | $self->restrict(), | ||||||||||||||||||||||||||||
| 558 | SOAP::Data->type(boolean=>($self->safe() | ||||||||||||||||||||||||||||
| 559 | ? "true" : "false")), | ||||||||||||||||||||||||||||
| 560 | # see above | ||||||||||||||||||||||||||||
| 561 | # ? 1 : 0)), | ||||||||||||||||||||||||||||
| 562 | $self->lr(), | ||||||||||||||||||||||||||||
| 563 | # input encoding | ||||||||||||||||||||||||||||
| 564 | undef, | ||||||||||||||||||||||||||||
| 565 | # output encoding | ||||||||||||||||||||||||||||
| 566 | undef, | ||||||||||||||||||||||||||||
| 567 | ); | ||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||
| 569 | 0 | ▶ | if (! $response) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 570 | 0 | return undef; | |||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||
| 573 | 0 | $self->{'__state'} = $self->_state(); | |||||||||||||||||||||||||||
| 574 | 0 | return Net::Google::Response->new($response); | |||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||
| 577 | 0 | ▶ | sub _state { | ||||||||||||||||||||||||||
|
Subroutine
_state: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 578 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 579 | 0 | my $state = undef; | |||||||||||||||||||||||||||
| 580 | 0 | map {$state .= $self->$_()} qw (query lr restrict safe filter starts_at max_results); | |||||||||||||||||||||||||||
| 581 | 0 | return $state; | |||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||
| 584 | =head1 VERSION | ||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | 1.0 | ||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | =head1 DATE | ||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||
| 590 | $Date: 2005/03/26 20:49:03 $ | ||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||
| 592 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||
| 594 | Aaron Straup Cope | ||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||
| 596 | =head1 CONTRIBUTORS | ||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||
| 598 | Marc Hedlund <marc@precipice.org> | ||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | =head1 TO DO | ||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||
| 602 | =over 4 | ||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||
| 604 | =item * | ||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||
| 606 | Add hooks to manage boolean searches and speacial query strings. | ||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | =back | ||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||
| 610 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||
| 612 | L<Net::Google> | ||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||
| 614 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||
| 616 | Copyright (c) 2002-2005, Aaron Straup Cope. All Rights Reserved. | ||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||
| 618 | This is free software, you may use it and distribute it under | ||||||||||||||||||||||||||||
| 619 | the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||
| 621 | =cut | ||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||
| 623 | 1 | return 1; | |||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||