line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ISC::DHCPd::Config::Zone; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Zone - Server Zone |
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 the block below: |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$name_attribute_value $value_attribute_value; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
zone $name { |
17
|
|
|
|
|
|
|
primary $primary; |
18
|
|
|
|
|
|
|
key $key; |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config/SYNOPSIS>. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
1232
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
with 'Net::ISC::DHCPd::Config::Role'; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 name |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Name of the Zone - See L</DESCRIPTION> for details. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 primary |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 key |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has [qw/ name key primary /] => ( |
44
|
|
|
|
|
|
|
is => 'rw', # TODO: WILL PROBABLY CHANGE! |
45
|
|
|
|
|
|
|
isa => 'Str', |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 regex |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/regex>. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# not sure if this can be quoted or not |
55
|
|
|
|
|
|
|
our $regex = qr{^\s* zone \s+ (")?(\S+)(\1|$) }x; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 METHODS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 slurp |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This method is used by L<Net::ISC::DHCPd::Config::Role/parse>, and will |
62
|
|
|
|
|
|
|
slurp the content of the function, instead of trying to parse the |
63
|
|
|
|
|
|
|
statements. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub slurp { |
68
|
0
|
|
|
0
|
1
|
|
my($self, $line) = @_; |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
return 'last' if($line =~ /^\s*}/); |
71
|
|
|
|
|
|
|
# not sure if these can really be quoted |
72
|
0
|
0
|
|
|
|
|
$self->primary($1) if($line =~ /primary \s+ (\S+);/x); |
73
|
0
|
0
|
|
|
|
|
$self->key($2) if($line =~ /key \s+ ("?)(\S+)\1;/x); |
74
|
0
|
|
|
|
|
|
return 'next'; |
75
|
|
|
|
|
|
|
} |
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
|
|
return { name => $_[1] }; # $_[0] == quote or empty string |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 generate |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/generate>. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub generate { |
94
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
return( |
97
|
0
|
0
|
|
|
|
|
sprintf('zone %s {', $self->name), |
|
|
0
|
|
|
|
|
|
98
|
|
|
|
|
|
|
$self->primary ? (sprintf ' primary %s;', $self->primary) : (), |
99
|
|
|
|
|
|
|
$self->key ? (sprintf ' key %s;', $self->key) : (), |
100
|
|
|
|
|
|
|
'}', |
101
|
|
|
|
|
|
|
); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHOR |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd>. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
113
|
|
|
|
|
|
|
1; |