line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
5
|
no warnings 'once'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
4
|
|
|
|
|
|
|
package Net::Continental::Zone 0.017; |
5
|
|
|
|
|
|
|
# ABSTRACT: a zone of IP space |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use Locale::Codes::Country 3.29 (); |
|
1
|
|
|
|
|
20
|
|
|
1
|
|
|
|
|
19
|
|
8
|
1
|
|
|
1
|
|
998
|
use Net::Domain::TLD (); |
|
1
|
|
|
|
|
13676
|
|
|
1
|
|
|
|
|
433
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#pod =method new |
11
|
|
|
|
|
|
|
#pod |
12
|
|
|
|
|
|
|
#pod B There is no C method for you to use. Instead, do this: |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod my $zone = Net::Continental->zone('au'); |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod =cut |
17
|
|
|
|
|
|
|
|
18
|
5
|
|
|
5
|
|
18
|
sub _new { bless $_[1] => $_[0] } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#pod =method code |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod This returns the zone's zone code. |
23
|
|
|
|
|
|
|
#pod |
24
|
|
|
|
|
|
|
#pod =method in_nerddk |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod This is true if the nerd.dk country blacklist is capable, using its encoding |
27
|
|
|
|
|
|
|
#pod scheme, of indicating a hit from this country. |
28
|
|
|
|
|
|
|
#pod |
29
|
|
|
|
|
|
|
#pod =method nerd_response |
30
|
|
|
|
|
|
|
#pod |
31
|
|
|
|
|
|
|
#pod This returns the response that will be given by the nerd.dk country blacklist |
32
|
|
|
|
|
|
|
#pod for IPs in this zone, if one is defined. |
33
|
|
|
|
|
|
|
#pod |
34
|
|
|
|
|
|
|
#pod =method continent |
35
|
|
|
|
|
|
|
#pod |
36
|
|
|
|
|
|
|
#pod This returns the continent in which the zone has been placed. These are |
37
|
|
|
|
|
|
|
#pod subject to change, for now, and there may be a method by which to define your |
38
|
|
|
|
|
|
|
#pod own classifications. I do not want to get angry email from people in Georgia! |
39
|
|
|
|
|
|
|
#pod |
40
|
|
|
|
|
|
|
#pod =method description |
41
|
|
|
|
|
|
|
#pod |
42
|
|
|
|
|
|
|
#pod This is a short description of the zone, like "United States" or "Soviet |
43
|
|
|
|
|
|
|
#pod Union." |
44
|
|
|
|
|
|
|
#pod |
45
|
|
|
|
|
|
|
#pod =method is_tld |
46
|
|
|
|
|
|
|
#pod |
47
|
|
|
|
|
|
|
#pod This returns true if the zone code is also a country code TLD. |
48
|
|
|
|
|
|
|
#pod |
49
|
|
|
|
|
|
|
#pod =cut |
50
|
|
|
|
|
|
|
|
51
|
10
|
|
|
10
|
1
|
2091
|
sub code { $_[0][0] } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub in_nerddk { |
54
|
0
|
|
|
0
|
1
|
0
|
return defined $_[0]->nerd_response; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub nerd_response { |
58
|
4
|
|
|
4
|
1
|
1236
|
my ($self) = @_; |
59
|
|
|
|
|
|
|
|
60
|
4
|
|
|
|
|
13
|
my $n = Locale::Codes::Country::country_code2code( |
61
|
|
|
|
|
|
|
$self->code, |
62
|
|
|
|
|
|
|
'alpha-2', |
63
|
|
|
|
|
|
|
'numeric', |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
4
|
50
|
|
|
|
544
|
return unless $n; |
67
|
4
|
|
|
|
|
11
|
my $top = $n >> 8; |
68
|
4
|
|
|
|
|
10
|
my $bot = $n % 256; |
69
|
4
|
|
|
|
|
51
|
return "127.0.$top.$bot"; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
0
|
1
|
0
|
sub continent { $Net::Continental::Continent{ $_[0][1] } } |
73
|
5
|
|
|
5
|
1
|
39
|
sub description { $_[0][2] } |
74
|
5
|
|
|
5
|
1
|
22
|
sub is_tld { Net::Domain::TLD::tld_exists($_[0][0], 'cc'); } |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub tld { |
77
|
2
|
50
|
|
2
|
0
|
9
|
return $_[0][3] if Net::Domain::TLD::tld_exists($_[0][3], 'cc'); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |