line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cikl::DataTypes::PortList; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
4
|
1
|
|
|
1
|
|
4
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
54
|
use Mouse::Util::TypeConstraints; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
subtype "Cikl::DataTypes::PortList", |
8
|
|
|
|
|
|
|
as 'Str', |
9
|
|
|
|
|
|
|
where { |
10
|
|
|
|
|
|
|
my $portlist = shift; |
11
|
|
|
|
|
|
|
foreach my $part (split(',', $portlist)) { |
12
|
|
|
|
|
|
|
if ($part =~ /^(\d+)(?:-(\d+))?$/) { |
13
|
|
|
|
|
|
|
my $start = $1; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# No end? Just use the start as the end. |
16
|
|
|
|
|
|
|
my $end = $2 || $start; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# The start should come before the end... |
19
|
|
|
|
|
|
|
if (($start > $end) || |
20
|
|
|
|
|
|
|
($start < 0 || $start > 65535) || |
21
|
|
|
|
|
|
|
($end < 0 || $end > 65535)) { |
22
|
|
|
|
|
|
|
return 0; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} else { |
25
|
|
|
|
|
|
|
return 0; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
return 1; |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|