line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ISC::DHCPd::Config::KeyValue; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::KeyValue - Misc option 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 one of the |
13
|
|
|
|
|
|
|
lines below, dependent on L</quoted>. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$name_attribute_value "$value_attribute_value"; |
16
|
|
|
|
|
|
|
$name_attribute_value $value_attribute_value; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
This means that this class represents "anything" that does not |
19
|
|
|
|
|
|
|
fall into any of the other categories and can be expressed as a |
20
|
|
|
|
|
|
|
key-value pair. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config/SYNOPSIS>. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
21
|
|
|
21
|
|
13199
|
use Moose; |
|
21
|
|
|
|
|
58
|
|
|
21
|
|
|
|
|
154
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
with 'Net::ISC::DHCPd::Config::Role'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 name |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Name of the option - See L</DESCRIPTION> for details. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has name => ( |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
isa => 'Str', |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 value |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Value of the option - See L</DESCRIPTION> for details. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has value => ( |
52
|
|
|
|
|
|
|
is => 'ro', |
53
|
|
|
|
|
|
|
isa => 'Str', |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 quoted |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This flag tells if the option value should be quoted or not. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
has quoted => ( |
63
|
|
|
|
|
|
|
is => 'ro', |
64
|
|
|
|
|
|
|
isa => 'Bool', |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 regex |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/regex>. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
our $regex = qr{^\s* ([\w-]+) \s+ (.*) ;}x; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 METHODS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 captured_to_args |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/captured_to_args>. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub captured_to_args { |
84
|
0
|
|
|
0
|
1
|
|
my $name = shift; |
85
|
0
|
|
|
|
|
|
my $value = shift; |
86
|
0
|
|
|
|
|
|
my $quoted = 0; |
87
|
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
$quoted = 1 if($value =~ s/^"(.*)"$/$1/g); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
return { |
91
|
0
|
|
|
|
|
|
name => $name, |
92
|
|
|
|
|
|
|
value => $value, |
93
|
|
|
|
|
|
|
quoted => $quoted, |
94
|
|
|
|
|
|
|
}; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 generate |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/generate>. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub generate { |
104
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
105
|
0
|
0
|
|
|
|
|
my $format = $self->quoted ? qq(%s "%s";) : qq(%s %s;); |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
return sprintf $format, $self->name, $self->value; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 AUTHOR |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd>. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
118
|
|
|
|
|
|
|
1; |