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