line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ISC::DHCPd::Config::Range; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Range - Range config parameter |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role> for methods and attributes without |
10
|
|
|
|
|
|
|
documentation. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
An instance from this class, comes from / will produce: |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
range $lower_attribute_value $upper_attribute_value; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config/SYNOPSIS>. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 NOTES |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
L</upper> and L</lower> attributes might change from L<NetAddr::IP> to |
23
|
|
|
|
|
|
|
plain strings in the future. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
25
|
|
|
25
|
|
16466
|
use Moose; |
|
25
|
|
|
|
|
51
|
|
|
25
|
|
|
|
|
169
|
|
28
|
25
|
|
|
25
|
|
132144
|
use NetAddr::IP; |
|
25
|
|
|
|
|
60
|
|
|
25
|
|
|
|
|
236
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
with 'Net::ISC::DHCPd::Config::Role'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 upper |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This attribute holds a L<NetAddr::IP> object, representing the |
37
|
|
|
|
|
|
|
highest IP address in the range. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has upper => ( |
42
|
|
|
|
|
|
|
is => 'ro', |
43
|
|
|
|
|
|
|
isa => 'Object', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 lower |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This attribute holds a L<NetAddr::IP> object, representing the |
49
|
|
|
|
|
|
|
lowest IP address in the range. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
has lower => ( |
54
|
|
|
|
|
|
|
is => 'ro', |
55
|
|
|
|
|
|
|
isa => 'Object', |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 regex |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/regex>. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
our $regex = qr{^\s* range \s+ (\S+) (?:\s+ (\S*))? ;}x; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 captured_to_args |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/captured_to_args>. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub captured_to_args { |
75
|
|
|
|
|
|
|
|
76
|
13
|
100
|
|
13
|
1
|
42
|
if (!defined($_[1])) { |
77
|
1
|
|
|
|
|
7
|
return { lower => NetAddr::IP->new($_[0]) }; |
78
|
|
|
|
|
|
|
} else { |
79
|
|
|
|
|
|
|
return { |
80
|
12
|
|
|
|
|
64
|
lower => NetAddr::IP->new($_[0]), |
81
|
|
|
|
|
|
|
upper => NetAddr::IP->new($_[1]), |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 generate |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/generate>. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub generate { |
93
|
5
|
|
|
5
|
1
|
8
|
my $self = shift; |
94
|
5
|
100
|
|
|
|
129
|
if (defined($self->upper)) { |
95
|
4
|
|
|
|
|
85
|
return 'range ' .$self->lower->addr .' ' .$self->upper->addr .';'; |
96
|
|
|
|
|
|
|
} else { |
97
|
1
|
|
|
|
|
45
|
return 'range ' .$self->lower->addr.';'; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd>. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
109
|
|
|
|
|
|
|
1; |