| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::ISC::DHCPd::Config::Conditional; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Conditional - if, elsif and/or else 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
|
|
|
|
|
|
|
if option dhcp-user-class = "accounting" { |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
elsif option dhcp-user-class = "sales" { |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
else { |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config/SYNOPSIS>. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
24
|
|
|
24
|
|
20672
|
use Moose; |
|
|
24
|
|
|
|
|
62
|
|
|
|
24
|
|
|
|
|
217
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
with 'Net::ISC::DHCPd::Config::Role'; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 children |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/children>. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
|
36
|
|
|
|
|
|
|
sub children { |
|
37
|
35
|
|
|
35
|
1
|
354
|
return qw/ |
|
38
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Subnet |
|
39
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Subnet6 |
|
40
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::SharedNetwork |
|
41
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Group |
|
42
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Host |
|
43
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Option |
|
44
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::KeyValue |
|
45
|
|
|
|
|
|
|
/; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__PACKAGE__->create_children(__PACKAGE__->children()); |
|
49
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 type |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has type => ( |
|
56
|
|
|
|
|
|
|
is => 'ro', |
|
57
|
|
|
|
|
|
|
isa => 'Str', |
|
58
|
|
|
|
|
|
|
); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 logic |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
has logic => ( |
|
65
|
|
|
|
|
|
|
is => 'ro', |
|
66
|
|
|
|
|
|
|
isa => 'Str', |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 regex |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/regex>. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
|
74
|
122
|
|
|
122
|
1
|
1064
|
sub regex { qr/^ \s* (if|elsif|else) (.*?)(\s+\{|$) /x } |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 METHODS |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 captured_to_args |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/captured_to_args>. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub captured_to_args { |
|
85
|
7
|
|
|
7
|
1
|
12
|
my($type, $logic) = @_; |
|
86
|
|
|
|
|
|
|
|
|
87
|
7
|
|
|
|
|
44
|
$logic =~ s/^\s+|\s+$//g; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
return { |
|
90
|
7
|
|
|
|
|
31
|
type => $type, |
|
91
|
|
|
|
|
|
|
logic => $logic, |
|
92
|
|
|
|
|
|
|
}; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 generate |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/generate>. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub generate { |
|
102
|
7
|
|
|
7
|
1
|
9
|
my $self = shift; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
return( |
|
105
|
7
|
100
|
|
|
|
276
|
$self->logic ? sprintf('%s %s {', $self->type, $self->logic) : $self->type .' {', |
|
106
|
|
|
|
|
|
|
$self->generate_config_from_children, |
|
107
|
|
|
|
|
|
|
'}', |
|
108
|
|
|
|
|
|
|
); |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd>. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
|
118
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
119
|
|
|
|
|
|
|
1; |