| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Phone::Info; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20588
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
5
|
1
|
|
|
1
|
|
734
|
use Net::WhitePages; |
|
|
1
|
|
|
|
|
1037031
|
|
|
|
1
|
|
|
|
|
1491
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Phone::Info - Fetches phone info. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.0.1 |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.0.1'; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Quick summary of what the module does. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Perhaps a little code snippet. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use Phone::Info; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $pi = Phone::Info->new(); |
|
29
|
|
|
|
|
|
|
... |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 METHODS |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 new |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head3 args hash |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head4 token |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This is the API key to use. Get one at "http://www.whitepages.com/". |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
If this is not defined $ENV{WHITEPAGESTOKEN} is used. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
|
46
|
0
|
|
|
0
|
1
|
|
my %args; |
|
47
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
|
48
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
|
0
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $self={error=>undef, errorString=>''}; |
|
52
|
0
|
|
|
|
|
|
bless $self; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#get the token |
|
55
|
0
|
0
|
|
|
|
|
if (!defined($args{token})) { |
|
56
|
0
|
0
|
|
|
|
|
if (!defined($ENV{WHITEPAGESTOKEN})) { |
|
57
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
58
|
0
|
|
|
|
|
|
$self->{errorString}='$args{token} is not defined and $ENV{WHITEPAGESTOKEN} is also not defined'; |
|
59
|
0
|
|
|
|
|
|
warn('Phone-Info new:1: '.$self->{errorString}); |
|
60
|
0
|
|
|
|
|
|
return $self; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
0
|
|
|
|
|
|
$self->{token}=$ENV{WHITEPAGESTOKEN}; |
|
63
|
|
|
|
|
|
|
}else { |
|
64
|
0
|
|
|
|
|
|
$self->{token}=$args{token}; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#create the object |
|
68
|
0
|
|
|
|
|
|
$self->{wp}=Net::WhitePages->new(TOKEN =>$self->{token}); |
|
69
|
0
|
0
|
|
|
|
|
if (!defined($self->{wp})) { |
|
70
|
0
|
|
|
|
|
|
$self->{error}=2; |
|
71
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to create the Net::WhitePages object'; |
|
72
|
0
|
|
|
|
|
|
warn('Phone-Info new:2: '.$self->{errorString}); |
|
73
|
0
|
|
|
|
|
|
return $self; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return $self; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 find_person |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
For a deeper understanding of values, check the URL below. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
http://developer.whitepages.com/docs/Methods/find_person |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head3 args hash |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head4 firstname |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
The first name to search for. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head4 lastname |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The last name to search for. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head4 name |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
The name to search for. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head4 house |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
The house number. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head4 street |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
The street name to search. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head4 city |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The city to search. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head4 state |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
The 2 letter state to search. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head4 zip |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
The 5 or 9 digit zip code. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head4 areacode |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
The phone area code to search. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head4 metro |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
A boolean value determining if the search should be expanded to the metro areas. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
my $res=$pi->find_person(\%args); |
|
128
|
|
|
|
|
|
|
if($pi->{error}){ |
|
129
|
|
|
|
|
|
|
print "Error!\n"; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub find_person{ |
|
135
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
136
|
0
|
|
|
|
|
|
my %args; |
|
137
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
|
138
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
|
0
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
|
$self->errorblank; |
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
my $res = $self->{wp}->find_person( |
|
144
|
|
|
|
|
|
|
firstname=>$args{firstname}, |
|
145
|
|
|
|
|
|
|
lastname=>$args{lastname}, |
|
146
|
|
|
|
|
|
|
house=>$args{house}, |
|
147
|
|
|
|
|
|
|
street=>$args{street}, |
|
148
|
|
|
|
|
|
|
city=>$args{city}, |
|
149
|
|
|
|
|
|
|
state=>$args{state}, |
|
150
|
|
|
|
|
|
|
zip=>$args{zip}, |
|
151
|
|
|
|
|
|
|
areacode=>$args{areacode}, |
|
152
|
|
|
|
|
|
|
metro=>$args{metro}, |
|
153
|
|
|
|
|
|
|
); |
|
154
|
|
|
|
|
|
|
|
|
155
|
0
|
0
|
|
|
|
|
if (!defined($res)) { |
|
156
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
157
|
0
|
|
|
|
|
|
$self->{errorString}='Net::WhitePages->find_person errored. $res is not defined'; |
|
158
|
0
|
|
|
|
|
|
warn('Phone-Info person:3: '.$self->{errorString}); |
|
159
|
0
|
|
|
|
|
|
return undef; |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
0
|
0
|
|
|
|
|
if (!defined($res->{result})) { |
|
163
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
164
|
0
|
|
|
|
|
|
$self->{errorString}='Net::WhitePages->find_person errored. $res->{result} is not defined'; |
|
165
|
0
|
|
|
|
|
|
warn('Phone-Info person:3: '.$self->{errorString}); |
|
166
|
0
|
|
|
|
|
|
return undef; |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
|
|
169
|
0
|
0
|
|
|
|
|
if (!defined($res->{result}{type})) { |
|
170
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
171
|
0
|
|
|
|
|
|
$self->{errorString}='Net::WhitePages->find_person errored. $res->{result}{type} is not defined'; |
|
172
|
0
|
|
|
|
|
|
warn('Phone-Info person:3: '.$self->{errorString}); |
|
173
|
0
|
|
|
|
|
|
return undef; |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
|
|
176
|
0
|
0
|
|
|
|
|
if ($res->{result}{type} ne 'success') { |
|
177
|
0
|
|
|
|
|
|
$self->{error}=4; |
|
178
|
0
|
|
|
|
|
|
$self->{errorString}='Look up errored. $res->{result}{type} is not defined'; |
|
179
|
0
|
|
|
|
|
|
warn('Phone-Info person:4: '.$self->{errorString}); |
|
180
|
0
|
|
|
|
|
|
return undef; |
|
181
|
|
|
|
|
|
|
} |
|
182
|
|
|
|
|
|
|
|
|
183
|
0
|
|
|
|
|
|
return $res; |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 resFormat |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Create a string from the results. |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head3 args hash |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head4 res |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This is the returned search data. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head4 format |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
This is the format string for each item. See the format section |
|
199
|
|
|
|
|
|
|
for more information on this. |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head4 header |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
The header that will be attached at the top. |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
If this is not defined, it is created based on the format. |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
For no header, set this to ''. |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
This should also include a new line. |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head4 quote |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
If this is set to true, the fields will be quoted. |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
This defaults to true. |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head4 quotechar |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
This is the character that should be used for quoting. |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
The default is '"'. |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
my $res=$pi->person(\%args); |
|
224
|
|
|
|
|
|
|
if($pi->{error}){ |
|
225
|
|
|
|
|
|
|
print "Error!\n"; |
|
226
|
|
|
|
|
|
|
} |
|
227
|
|
|
|
|
|
|
$pi->resFormat({ |
|
228
|
|
|
|
|
|
|
res=>$res, |
|
229
|
|
|
|
|
|
|
format=>$format, |
|
230
|
|
|
|
|
|
|
header=>$header, |
|
231
|
|
|
|
|
|
|
seperator=>',', |
|
232
|
|
|
|
|
|
|
quote=>1, |
|
233
|
|
|
|
|
|
|
quotechar=>'"', |
|
234
|
|
|
|
|
|
|
}); |
|
235
|
|
|
|
|
|
|
if($pi->{error}){ |
|
236
|
|
|
|
|
|
|
print "Error!\n"; |
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=cut |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub resFormat{ |
|
242
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
243
|
0
|
|
|
|
|
|
my %args; |
|
244
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
|
245
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
|
0
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
} |
|
247
|
|
|
|
|
|
|
|
|
248
|
0
|
|
|
|
|
|
$self->errorblank; |
|
249
|
|
|
|
|
|
|
|
|
250
|
0
|
0
|
|
|
|
|
if (!defined($args{res})) { |
|
251
|
0
|
|
|
|
|
|
$self->{error}=4; |
|
252
|
0
|
|
|
|
|
|
$self->{errorString}='No search results passed'; |
|
253
|
0
|
|
|
|
|
|
warn('Phone-Info resFormat:4: '.$self->{errorString}); |
|
254
|
0
|
|
|
|
|
|
return undef; |
|
255
|
|
|
|
|
|
|
} |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
#the format to use for printing it out |
|
258
|
0
|
0
|
|
|
|
|
if (!defined($args{format})) { |
|
259
|
0
|
|
|
|
|
|
$args{format}='firstname,middlename,lastname,phone,house,street,city,state,zip'; |
|
260
|
|
|
|
|
|
|
} |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
#if headers should be printed or not |
|
263
|
0
|
0
|
|
|
|
|
if (!defined($args{header})) { |
|
264
|
0
|
|
|
|
|
|
$args{header}=$args{format}."\n"; |
|
265
|
0
|
|
|
|
|
|
$args{header}=~s/\,/ \, /g; |
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
#what seperates the various fields |
|
269
|
0
|
0
|
|
|
|
|
if (!defined($args{seperator})) { |
|
270
|
0
|
|
|
|
|
|
$args{seperator}=" , "; |
|
271
|
|
|
|
|
|
|
} |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
#the character to use for quotes |
|
274
|
0
|
0
|
|
|
|
|
if (!defined($args{quotechar})) { |
|
275
|
0
|
|
|
|
|
|
$args{quotechar}='"'; |
|
276
|
|
|
|
|
|
|
} |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
#default to quoting |
|
279
|
0
|
0
|
|
|
|
|
if (!defined($args{quote})) { |
|
280
|
0
|
|
|
|
|
|
$args{quote}=1; |
|
281
|
|
|
|
|
|
|
} |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
#the string that will be returned |
|
284
|
0
|
|
|
|
|
|
my $toreturn=$args{header}; |
|
285
|
|
|
|
|
|
|
|
|
286
|
0
|
|
|
|
|
|
my @format=split(/,/, $args{format}); |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
#put it together |
|
289
|
0
|
|
|
|
|
|
my $int=0; |
|
290
|
0
|
|
|
|
|
|
while (defined( $args{res}->{listings}[$int] )) { |
|
291
|
0
|
|
|
|
|
|
my $fint=0; |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
#put the line together |
|
294
|
0
|
|
|
|
|
|
while (defined( $format[$fint] )) { |
|
295
|
0
|
|
|
|
|
|
my $data; |
|
296
|
0
|
0
|
|
|
|
|
if ($format[$fint] eq 'firstname') { |
|
297
|
0
|
|
|
|
|
|
$data=$args{res}->{listings}[$int]{people}[0]{firstname}; |
|
298
|
|
|
|
|
|
|
} |
|
299
|
|
|
|
|
|
|
|
|
300
|
0
|
0
|
|
|
|
|
if ($format[$fint] eq 'middlename') { |
|
301
|
0
|
|
|
|
|
|
$data=$args{res}->{listings}[$int]{people}[0]{middlename}; |
|
302
|
|
|
|
|
|
|
} |
|
303
|
|
|
|
|
|
|
|
|
304
|
0
|
0
|
|
|
|
|
if ($format[$fint] eq 'lastname') { |
|
305
|
0
|
|
|
|
|
|
$data=$args{res}->{listings}[$int]{people}[0]{lastname}; |
|
306
|
|
|
|
|
|
|
} |
|
307
|
|
|
|
|
|
|
|
|
308
|
0
|
0
|
|
|
|
|
if ($format[$fint] eq 'phone') { |
|
309
|
0
|
|
|
|
|
|
$data=$args{res}->{listings}[$int]{phonenumbers}[0]{fullphone}; |
|
310
|
|
|
|
|
|
|
} |
|
311
|
|
|
|
|
|
|
|
|
312
|
0
|
0
|
|
|
|
|
if ($format[$fint] eq 'house') { |
|
313
|
0
|
|
|
|
|
|
$data=$args{res}->{listings}[$int]{address}{house}; |
|
314
|
|
|
|
|
|
|
} |
|
315
|
|
|
|
|
|
|
|
|
316
|
0
|
0
|
|
|
|
|
if ($format[$fint] eq 'street') { |
|
317
|
0
|
|
|
|
|
|
$data=$args{res}->{listings}[$int]{address}{street}; |
|
318
|
|
|
|
|
|
|
} |
|
319
|
|
|
|
|
|
|
|
|
320
|
0
|
0
|
|
|
|
|
if ($format[$fint] eq 'city') { |
|
321
|
0
|
|
|
|
|
|
$data=$args{res}->{listings}[$int]{address}{city}; |
|
322
|
|
|
|
|
|
|
} |
|
323
|
|
|
|
|
|
|
|
|
324
|
0
|
0
|
|
|
|
|
if ($format[$fint] eq 'state') { |
|
325
|
0
|
|
|
|
|
|
$data=$args{res}->{listings}[$int]{address}{state}; |
|
326
|
|
|
|
|
|
|
} |
|
327
|
|
|
|
|
|
|
|
|
328
|
0
|
0
|
|
|
|
|
if ($format[$fint] eq 'zip') { |
|
329
|
0
|
|
|
|
|
|
$data=$args{res}->{listings}[$int]{address}{zip}; |
|
330
|
|
|
|
|
|
|
} |
|
331
|
|
|
|
|
|
|
|
|
332
|
0
|
0
|
|
|
|
|
if (!defined($data)) { |
|
333
|
0
|
|
|
|
|
|
$data=''; |
|
334
|
|
|
|
|
|
|
} |
|
335
|
|
|
|
|
|
|
|
|
336
|
0
|
0
|
|
|
|
|
if ($args{quote}) { |
|
337
|
0
|
|
|
|
|
|
$data=$args{quotechar}.$data.$args{quotechar}; |
|
338
|
|
|
|
|
|
|
} |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
#append the data to what is to be returned |
|
341
|
0
|
|
|
|
|
|
$toreturn=$toreturn.$data; |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
#if it is at the end, don't append the seperator |
|
344
|
0
|
0
|
|
|
|
|
if ($fint ne $#format) { |
|
345
|
0
|
|
|
|
|
|
$toreturn=$toreturn.$args{seperator}; |
|
346
|
|
|
|
|
|
|
} |
|
347
|
|
|
|
|
|
|
|
|
348
|
0
|
|
|
|
|
|
$fint++; |
|
349
|
|
|
|
|
|
|
} |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
#stick a new line on before starting another line |
|
352
|
0
|
|
|
|
|
|
$toreturn=$toreturn."\n"; |
|
353
|
|
|
|
|
|
|
|
|
354
|
0
|
|
|
|
|
|
$int++; |
|
355
|
|
|
|
|
|
|
} |
|
356
|
|
|
|
|
|
|
|
|
357
|
0
|
|
|
|
|
|
return $toreturn; |
|
358
|
|
|
|
|
|
|
} |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
=head2 reverse_address |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
This finds related phone number based on their address. |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
See the link below for more information. |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
http://developer.whitepages.com/docs/Methods/reverse_address |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
=head3 args hash |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=head4 apt |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
The apt to search for. |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=head4 house |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
The house number searched to search for. This can be |
|
377
|
|
|
|
|
|
|
number take a range, "100-200". |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=head4 city |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
The city to search. |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=head4 state |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
The state to search. |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=head4 zip |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
The sip code to search. |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=head4 areacode |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
This is the area code to search. |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
my $res=$pi->reverse_address(\%args); |
|
396
|
|
|
|
|
|
|
if($pi->{error}){ |
|
397
|
|
|
|
|
|
|
print "Error!\n"; |
|
398
|
|
|
|
|
|
|
} |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
=cut |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
sub reverse_address{ |
|
403
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
404
|
0
|
|
|
|
|
|
my %args; |
|
405
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
|
406
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
|
0
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
} |
|
408
|
|
|
|
|
|
|
|
|
409
|
0
|
|
|
|
|
|
$self->errorblank; |
|
410
|
|
|
|
|
|
|
|
|
411
|
0
|
|
|
|
|
|
my $res = $self->{wp}->reverse_address( |
|
412
|
|
|
|
|
|
|
apt=>$args{apt}, |
|
413
|
|
|
|
|
|
|
house=>$args{house}, |
|
414
|
|
|
|
|
|
|
city=>$args{city}, |
|
415
|
|
|
|
|
|
|
state=>$args{state}, |
|
416
|
|
|
|
|
|
|
zip=>$args{zip}, |
|
417
|
|
|
|
|
|
|
areacode=>$args{areacode}, |
|
418
|
|
|
|
|
|
|
street=>$args{street} |
|
419
|
|
|
|
|
|
|
); |
|
420
|
|
|
|
|
|
|
|
|
421
|
0
|
0
|
|
|
|
|
if (!defined($res)) { |
|
422
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
423
|
0
|
|
|
|
|
|
$self->{errorString}='Net::WhitePages->reverse_address errored. $res is not defined'; |
|
424
|
0
|
|
|
|
|
|
warn('Phone-Info reverse_address:3: '.$self->{errorString}); |
|
425
|
0
|
|
|
|
|
|
return undef; |
|
426
|
|
|
|
|
|
|
} |
|
427
|
|
|
|
|
|
|
|
|
428
|
0
|
0
|
|
|
|
|
if (!defined($res->{result})) { |
|
429
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
430
|
0
|
|
|
|
|
|
$self->{errorString}='Net::WhitePages->find_address errored. $res->{result} is not defined'; |
|
431
|
0
|
|
|
|
|
|
warn('Phone-Info reverse_address:3: '.$self->{errorString}); |
|
432
|
0
|
|
|
|
|
|
return undef; |
|
433
|
|
|
|
|
|
|
} |
|
434
|
|
|
|
|
|
|
|
|
435
|
0
|
0
|
|
|
|
|
if (!defined($res->{result}{type})) { |
|
436
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
437
|
0
|
|
|
|
|
|
$self->{errorString}='Net::WhitePages->find_address errored. $res->{result}{type} is not defined'; |
|
438
|
0
|
|
|
|
|
|
warn('Phone-Info reverse_address:3: '.$self->{errorString}); |
|
439
|
0
|
|
|
|
|
|
return undef; |
|
440
|
|
|
|
|
|
|
} |
|
441
|
|
|
|
|
|
|
|
|
442
|
0
|
0
|
|
|
|
|
if ($res->{result}{type} ne 'success') { |
|
443
|
0
|
|
|
|
|
|
$self->{error}=4; |
|
444
|
0
|
|
|
|
|
|
$self->{errorString}='Look up errored. $res->{result}{type} is not defined'; |
|
445
|
0
|
|
|
|
|
|
warn('Phone-Info reverse_address:4: '.$self->{errorString}); |
|
446
|
0
|
|
|
|
|
|
return undef; |
|
447
|
|
|
|
|
|
|
} |
|
448
|
|
|
|
|
|
|
|
|
449
|
0
|
|
|
|
|
|
return $res; |
|
450
|
|
|
|
|
|
|
} |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=head2 reverse_phone |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
This finds related addresses based on a phone number. |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
See the link below for more information. |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
http://developer.whitepages.com/docs/Methods/reverse_phone |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=head3 args hash |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
=head4 phone |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
This is the phone number to look up. |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
my $res=$pi->reverse_phone(\%args); |
|
467
|
|
|
|
|
|
|
if($pi->{error}){ |
|
468
|
|
|
|
|
|
|
print "Error!\n"; |
|
469
|
|
|
|
|
|
|
} |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=cut |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
sub reverse_phone{ |
|
474
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
475
|
0
|
|
|
|
|
|
my %args; |
|
476
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
|
477
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
|
0
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
} |
|
479
|
|
|
|
|
|
|
|
|
480
|
0
|
|
|
|
|
|
$self->errorblank; |
|
481
|
|
|
|
|
|
|
|
|
482
|
0
|
0
|
|
|
|
|
if (!defined($args{phone})) { |
|
483
|
0
|
|
|
|
|
|
$self->{error}=5; |
|
484
|
0
|
|
|
|
|
|
$self->{errorString}='No phone number specified. Please define $args{phone}'; |
|
485
|
0
|
|
|
|
|
|
warn('Phone-Info reverse_phone:5: '.$self->{errorString}); |
|
486
|
0
|
|
|
|
|
|
return undef; |
|
487
|
|
|
|
|
|
|
} |
|
488
|
|
|
|
|
|
|
|
|
489
|
0
|
|
|
|
|
|
my $res = $self->{wp}->reverse_phone( |
|
490
|
|
|
|
|
|
|
phone=>$args{phone}, |
|
491
|
|
|
|
|
|
|
); |
|
492
|
|
|
|
|
|
|
|
|
493
|
0
|
0
|
|
|
|
|
if (!defined($res)) { |
|
494
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
495
|
0
|
|
|
|
|
|
$self->{errorString}='Net::WhitePages->reverse_phone errored. $res is not defined'; |
|
496
|
0
|
|
|
|
|
|
warn('Phone-Info reverse_phone:3: '.$self->{errorString}); |
|
497
|
0
|
|
|
|
|
|
return undef; |
|
498
|
|
|
|
|
|
|
} |
|
499
|
|
|
|
|
|
|
|
|
500
|
0
|
0
|
|
|
|
|
if (!defined($res->{result})) { |
|
501
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
502
|
0
|
|
|
|
|
|
$self->{errorString}='Net::WhitePages->reverse_phone errored. $res->{result} is not defined'; |
|
503
|
0
|
|
|
|
|
|
warn('Phone-Info reverse_phone:3: '.$self->{errorString}); |
|
504
|
0
|
|
|
|
|
|
return undef; |
|
505
|
|
|
|
|
|
|
} |
|
506
|
|
|
|
|
|
|
|
|
507
|
0
|
0
|
|
|
|
|
if (!defined($res->{result}{type})) { |
|
508
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
509
|
0
|
|
|
|
|
|
$self->{errorString}='Net::WhitePages->reverse_phone errored. $res->{result}{type} is not defined'; |
|
510
|
0
|
|
|
|
|
|
warn('Phone-Info reverse_phone:3: '.$self->{errorString}); |
|
511
|
0
|
|
|
|
|
|
return undef; |
|
512
|
|
|
|
|
|
|
} |
|
513
|
|
|
|
|
|
|
|
|
514
|
0
|
0
|
|
|
|
|
if ($res->{result}{type} ne 'success') { |
|
515
|
0
|
|
|
|
|
|
$self->{error}=4; |
|
516
|
0
|
|
|
|
|
|
$self->{errorString}='Look up errored. $res->{result}{type} is not defined'; |
|
517
|
0
|
|
|
|
|
|
warn('Phone-Info reverse_phone:4: '.$self->{errorString}); |
|
518
|
0
|
|
|
|
|
|
return undef; |
|
519
|
|
|
|
|
|
|
} |
|
520
|
|
|
|
|
|
|
|
|
521
|
0
|
|
|
|
|
|
return $res; |
|
522
|
|
|
|
|
|
|
} |
|
523
|
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
=head2 errorblank |
|
525
|
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
This blanks the error storage and is only meant for internal usage. |
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
It does the following. |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
$self->{error}=undef; |
|
531
|
|
|
|
|
|
|
$self->{errorString}=""; |
|
532
|
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
=cut |
|
534
|
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
#blanks the error flags |
|
536
|
|
|
|
|
|
|
sub errorblank{ |
|
537
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
538
|
|
|
|
|
|
|
|
|
539
|
0
|
|
|
|
|
|
$self->{error}=undef; |
|
540
|
0
|
|
|
|
|
|
$self->{errorString}=""; |
|
541
|
|
|
|
|
|
|
|
|
542
|
0
|
|
|
|
|
|
return 1; |
|
543
|
|
|
|
|
|
|
} |
|
544
|
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
=head1 ERROR CODES |
|
546
|
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
=head2 1 |
|
548
|
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
$args{token} is not defined and $ENV{WHITEPAGESTOKEN} is also not defined. |
|
550
|
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
=head2 2 |
|
552
|
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
Failed to create the Net::WhitePages object. |
|
554
|
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
=head2 3 |
|
556
|
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
find_person errored. |
|
558
|
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=head2 4 |
|
560
|
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
No search results passed. |
|
562
|
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=head2 5 |
|
564
|
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
No phone number specified. |
|
566
|
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=head1 FORMAT STRING |
|
568
|
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
This is a comma seperated string comprised of various items listed below. |
|
570
|
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
This string sould not include any spaces or etc. |
|
572
|
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
=head2 firstname |
|
574
|
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
The first name of the first person found listed for the number. |
|
576
|
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
=head2 middlename |
|
578
|
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
The middle name for the first person found listed for the number. |
|
580
|
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
=head2 lastname |
|
582
|
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
The last name for the first person found listed for the number. |
|
584
|
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
=head2 phone |
|
586
|
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
The phone number. |
|
588
|
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
=head2 house |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
The house number for the address. |
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
=head2 street |
|
594
|
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
The street for the address. |
|
596
|
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
=head2 city |
|
598
|
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
The city the address is in. |
|
600
|
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
=head2 state |
|
602
|
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
The state the address is in. |
|
604
|
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
=head2 zip |
|
606
|
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
The zip code for the address. |
|
608
|
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
=head1 AUTHOR |
|
610
|
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
Zane C. Bowers, C<< >> |
|
612
|
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
=head1 BUGS |
|
614
|
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
616
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
617
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
618
|
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
=head1 SUPPORT |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
perldoc Phone::Info |
|
627
|
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
You can also look for information at: |
|
630
|
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
=over 4 |
|
632
|
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
634
|
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
L |
|
636
|
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
638
|
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
L |
|
640
|
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
642
|
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
L |
|
644
|
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
=item * Search CPAN |
|
646
|
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
L |
|
648
|
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
=back |
|
650
|
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
653
|
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
656
|
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
Copyright 2009 Zane C. Bowers, all rights reserved. |
|
658
|
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
660
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
=cut |
|
664
|
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
1; # End of Phone::Info |