| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
53
|
|
|
2
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
49
|
|
|
3
|
1
|
|
|
1
|
|
6
|
no warnings 'once'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
91
|
|
|
4
|
|
|
|
|
|
|
package Net::Continental::Zone; |
|
5
|
|
|
|
|
|
|
# ABSTRACT: a zone of IP space |
|
6
|
|
|
|
|
|
|
$Net::Continental::Zone::VERSION = '0.015'; |
|
7
|
1
|
|
|
1
|
|
7
|
use Locale::Codes::Country 3.29 (); |
|
|
1
|
|
|
|
|
26
|
|
|
|
1
|
|
|
|
|
27
|
|
|
8
|
1
|
|
|
1
|
|
778
|
use Net::Domain::TLD (); |
|
|
1
|
|
|
|
|
8590
|
|
|
|
1
|
|
|
|
|
390
|
|
|
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
|
2340
|
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
|
1755
|
my ($self) = @_; |
|
59
|
|
|
|
|
|
|
|
|
60
|
4
|
|
|
|
|
36
|
my $n = Locale::Codes::Country::country_code2code( |
|
61
|
|
|
|
|
|
|
$self->code, |
|
62
|
|
|
|
|
|
|
'alpha-2', |
|
63
|
|
|
|
|
|
|
'numeric', |
|
64
|
|
|
|
|
|
|
); |
|
65
|
|
|
|
|
|
|
|
|
66
|
4
|
50
|
|
|
|
466
|
return unless $n; |
|
67
|
4
|
|
|
|
|
7
|
my $top = $n >> 8; |
|
68
|
4
|
|
|
|
|
9
|
my $bot = $n % 256; |
|
69
|
4
|
|
|
|
|
31
|
return "127.0.$top.$bot"; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
|
|
0
|
1
|
0
|
sub continent { $Net::Continental::Continent{ $_[0][1] } } |
|
73
|
5
|
|
|
5
|
1
|
38
|
sub description { $_[0][2] } |
|
74
|
5
|
|
|
5
|
1
|
20
|
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__ |