line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ISC::DHCPd::Config::Option; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Option - 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
|
|
|
|
|
|
|
option $name_attribute_value "$value_attribute_value"; |
16
|
|
|
|
|
|
|
option $name_attribute_value $value_attribute_value; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config/SYNOPSIS>. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
21
|
|
|
21
|
|
12719
|
use Moose; |
|
21
|
|
|
|
|
41
|
|
|
21
|
|
|
|
|
157
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
with 'Net::ISC::DHCPd::Config::Role'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 name |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
A plain string representing the name of the option. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has name => ( |
37
|
|
|
|
|
|
|
is => 'ro', |
38
|
|
|
|
|
|
|
isa => 'Str', |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 value |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
A plain string representing the value of the option. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has value => ( |
48
|
|
|
|
|
|
|
is => 'ro', |
49
|
|
|
|
|
|
|
isa => 'Str', |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 quoted |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This flag tells if the option value should be quoted or not. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has quoted => ( |
59
|
|
|
|
|
|
|
is => 'ro', |
60
|
|
|
|
|
|
|
isa => 'Bool', |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 regex |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/regex>. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
our $regex = qr{^\s* option \s+ (\S+) \s+ (.*) ;}x; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 METHODS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 captured_to_args |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/captured_to_args>. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub captured_to_args { |
80
|
0
|
|
|
0
|
1
|
|
my $name = shift; |
81
|
0
|
|
|
|
|
|
my $value = shift; |
82
|
0
|
|
|
|
|
|
my $quoted = 0; |
83
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
|
$quoted = 1 if($value =~ s/^"(.*)"$/$1/g); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
return { |
87
|
0
|
|
|
|
|
|
name => $name, |
88
|
|
|
|
|
|
|
value => $value, |
89
|
|
|
|
|
|
|
quoted => $quoted, |
90
|
|
|
|
|
|
|
}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 generate |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/generate>. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub generate { |
100
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
101
|
0
|
0
|
|
|
|
|
my $format = $self->quoted ? qq(option %s "%s";) : qq(option %s %s;); |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
return sprintf $format, $self->name, $self->value; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd>. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
114
|
|
|
|
|
|
|
1; |