line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IP::CountryFlag::Params; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$IP::CountryFlag::Params::VERSION = '0.11'; |
4
|
|
|
|
|
|
|
$IP::CountryFlag::Params::AUTHORITY = 'cpan:MANWAR'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
IP::CountryFlag::Params - Placeholder for parameters for IP::CountryFlag. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.11 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
50
|
use 5.006; |
|
2
|
|
|
|
|
18
|
|
17
|
2
|
|
|
2
|
|
9
|
use strict; use warnings; |
|
2
|
|
|
2
|
|
3
|
|
|
2
|
|
|
|
|
37
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
45
|
|
18
|
2
|
|
|
2
|
|
8
|
use Data::Dumper; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
98
|
|
19
|
2
|
|
|
2
|
|
594
|
use Data::Validate::IP qw(is_ipv4 is_ipv6); |
|
2
|
|
|
|
|
47113
|
|
|
2
|
|
|
|
|
169
|
|
20
|
2
|
|
|
2
|
|
20
|
use parent 'Exporter'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
17
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our @EXPORT_OK = qw(validate); |
23
|
|
|
|
|
|
|
|
24
|
3
|
100
|
66
|
3
|
0
|
10
|
sub check_ip { die "ERROR: Received invalid IP [$_[0]]." unless (is_ipv4($_[0]) || is_ipv6($_[0])) }; |
25
|
1
|
50
|
|
1
|
0
|
38
|
sub check_path { die "ERROR: Received invalid Path [$_[0]]." unless (-d "$_[0]") }; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $FIELDS = { |
28
|
|
|
|
|
|
|
'ip' => { check => sub { check_ip(@_) }, type => 's' }, |
29
|
|
|
|
|
|
|
'path' => { check => sub { check_path(@_) }, type => 's' }, |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub validate { |
33
|
4
|
|
|
4
|
0
|
6
|
my ($fields, $values) = @_; |
34
|
|
|
|
|
|
|
|
35
|
4
|
50
|
|
|
|
9
|
die "ERROR: Missing params list." unless (defined $values); |
36
|
|
|
|
|
|
|
|
37
|
4
|
50
|
|
|
|
12
|
die "ERROR: Parameters have to be hash ref" unless (ref($values) eq 'HASH'); |
38
|
|
|
|
|
|
|
|
39
|
4
|
|
|
|
|
5
|
foreach my $field (sort keys %{$fields}) { |
|
4
|
|
|
|
|
18
|
|
40
|
|
|
|
|
|
|
die "ERROR: Received invalid param: $field" |
41
|
6
|
50
|
|
|
|
55
|
unless (exists $FIELDS->{$field}); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
die "ERROR: Missing mandatory param: $field" |
44
|
6
|
100
|
66
|
|
|
38
|
if ($fields->{$field} && !exists $values->{$field}); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
die "ERROR: Received undefined mandatory param: $field" |
47
|
4
|
50
|
33
|
|
|
17
|
if ($fields->{$field} && !defined $values->{$field}); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$FIELDS->{$field}->{check}->($values->{$field}) |
50
|
4
|
50
|
|
|
|
14
|
if defined $values->{$field}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 AUTHOR |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Mohammad S Anwar, C<< >> |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 REPOSITORY |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 BUGS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Please report any bugs / feature requests to C, |
65
|
|
|
|
|
|
|
or through the web interface at L. |
66
|
|
|
|
|
|
|
I will be notified & then you'll automatically be notified of progress on your bug |
67
|
|
|
|
|
|
|
as I make changes. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SUPPORT |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
perldoc IP::CountryFlag::Params |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
You can also look for information at: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over 4 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * CPAN Ratings |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
L |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * Search CPAN |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Copyright (C) 2011 - 2017 Mohammad S Anwar. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
102
|
|
|
|
|
|
|
the terms of the the Artistic License (2.0). You may obtain a copy of the full |
103
|
|
|
|
|
|
|
license at: |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified Versions is |
108
|
|
|
|
|
|
|
governed by this Artistic License.By using, modifying or distributing the Package, |
109
|
|
|
|
|
|
|
you accept this license. Do not use, modify, or distribute the Package, if you do |
110
|
|
|
|
|
|
|
not accept this license. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made by someone |
113
|
|
|
|
|
|
|
other than you,you are nevertheless required to ensure that your Modified Version |
114
|
|
|
|
|
|
|
complies with the requirements of this license. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service mark, |
117
|
|
|
|
|
|
|
tradename, or logo of the Copyright Holder. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge patent license |
120
|
|
|
|
|
|
|
to make, have made, use, offer to sell, sell, import and otherwise transfer the |
121
|
|
|
|
|
|
|
Package with respect to any patent claims licensable by the Copyright Holder that |
122
|
|
|
|
|
|
|
are necessarily infringed by the Package. If you institute patent litigation |
123
|
|
|
|
|
|
|
(including a cross-claim or counterclaim) against any party alleging that the |
124
|
|
|
|
|
|
|
Package constitutes direct or contributory patent infringement,then this Artistic |
125
|
|
|
|
|
|
|
License to you shall terminate on the date that such litigation is filed. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND |
128
|
|
|
|
|
|
|
CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED |
129
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR |
130
|
|
|
|
|
|
|
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS |
131
|
|
|
|
|
|
|
REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, |
132
|
|
|
|
|
|
|
INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE |
133
|
|
|
|
|
|
|
OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
DEAFilter API itself is distributed under the terms of the Gnu GPLv3 licence. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; # End of IP::CountryFlag::Params |