line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Processor::Field::CIDR_List; |
2
|
|
|
|
|
|
|
$Form::Processor::Field::CIDR_List::VERSION = '1.162360'; |
3
|
1
|
|
|
1
|
|
582
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
2
|
use base 'Form::Processor::Field::Text'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
366
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use Net::CIDR; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
144
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub validate { |
11
|
2
|
|
|
2
|
1
|
2
|
my $self = shift; |
12
|
|
|
|
|
|
|
|
13
|
2
|
50
|
|
|
|
6
|
return unless $self->SUPER::validate; |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
50
|
|
|
4
|
my $input = $self->input || return 1; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
6
|
for my $addr ( split /\s+/, $input ) { |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Is it a plain ip address? |
20
|
2
|
50
|
|
|
|
4
|
next if Net::CIDR::cidrvalidate( $addr ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# If not see if it blows up in a cidr check |
23
|
2
|
|
|
|
|
665
|
eval { Net::CIDR::cidrlookup( '192.168.1.1', $addr ) }; |
|
2
|
|
|
|
|
6
|
|
24
|
2
|
100
|
|
|
|
366
|
next unless $@; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
5
|
return $self->add_error( "Failed to parse address '[_1]'", $addr ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
3
|
return 1; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# ABSTRACT: Muliplt CIDR addresses |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |