line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::IP::Record; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
23
|
use Geo::IP; # |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
779
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
26
|
use vars qw/$pp/; |
|
7
|
|
|
|
|
6
|
|
|
7
|
|
|
|
|
276
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
20
|
use strict; |
|
7
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
560
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# here are the missing functions if the C API is used |
10
|
|
|
|
|
|
|
sub latitude { |
11
|
|
|
|
|
|
|
my $gir = shift; |
12
|
|
|
|
|
|
|
return sprintf( "%.4f", $gir->_latitude ); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub longitude { |
16
|
|
|
|
|
|
|
my $gir = shift; |
17
|
|
|
|
|
|
|
return sprintf( "%.4f", $gir->_longitude ); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
BEGIN { |
21
|
7
|
|
33
|
7
|
|
224
|
$pp = !defined(&Geo::IP::Record::city) |
22
|
|
|
|
|
|
|
|| $Geo::IP::GEOIP_PP_ONLY; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
7
|
50
|
50
|
7
|
1
|
25
|
eval <<'__PP__' if $pp; |
|
7
|
50
|
|
7
|
1
|
6
|
|
|
7
|
50
|
|
7
|
1
|
167
|
|
|
7
|
|
|
12
|
|
20
|
|
|
7
|
|
|
1
|
|
7
|
|
|
7
|
|
|
1
|
|
399
|
|
|
7
|
|
|
1
|
|
21
|
|
|
7
|
|
|
1
|
|
6
|
|
|
7
|
|
|
|
|
1375
|
|
|
12
|
|
|
|
|
72
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
for ( qw: country_code country_code3 country_name |
28
|
|
|
|
|
|
|
region region_name city |
29
|
|
|
|
|
|
|
postal_code dma_code area_code |
30
|
|
|
|
|
|
|
continent_code metro_code : ) { |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
no strict qw/ refs /; |
33
|
|
|
|
|
|
|
no warnings qw/ redefine /; |
34
|
|
|
|
|
|
|
my $m = $_; # looks bogus, but it is not! it is a copy not a alias |
35
|
|
|
|
|
|
|
*$_ = sub { $_[0]->{$m} }; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# for the case warnings are globaly enabled with perl -w and the CAPI is absent |
39
|
|
|
|
|
|
|
no warnings qw/ redefine /; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub longitude {sprintf('%.4f', $_[0]->{longitude})} |
42
|
|
|
|
|
|
|
sub latitude {sprintf('%.4f', $_[0]->{latitude})} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
{ |
45
|
|
|
|
|
|
|
my $TIME_ZONE; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
local $_ = ; # skip first line |
48
|
|
|
|
|
|
|
while () { |
49
|
|
|
|
|
|
|
chomp; |
50
|
|
|
|
|
|
|
next if /^\s*$/; |
51
|
|
|
|
|
|
|
my ( $country, $region, $timezone ) = split /,/, $_, 3; |
52
|
|
|
|
|
|
|
$TIME_ZONE->{$country}->{ $region || '' } = $timezone; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# called from Geo::IP |
56
|
|
|
|
|
|
|
sub _time_zone { |
57
|
|
|
|
|
|
|
my ( undef, $country, $region ) = @_; |
58
|
|
|
|
|
|
|
return undef unless $country; |
59
|
|
|
|
|
|
|
return undef unless defined $TIME_ZONE->{$country}; |
60
|
|
|
|
|
|
|
$region ||= ''; |
61
|
|
|
|
|
|
|
return |
62
|
|
|
|
|
|
|
defined $TIME_ZONE->{$country}->{$region} |
63
|
|
|
|
|
|
|
? $TIME_ZONE->{$country}->{$region} |
64
|
|
|
|
|
|
|
: $TIME_ZONE->{$country}->{''}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
sub time_zone { |
67
|
|
|
|
|
|
|
my ( $self ) = @_; |
68
|
|
|
|
|
|
|
my ( $country, $region ) = ( $self->country_code, $self->region ); |
69
|
|
|
|
|
|
|
return $self->_time_zone( $country, $region ); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__PP__ |
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
__DATA__ |