DHCPd/Config/Subnet6.pm

filter: Statementstmt 85.7% 18 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 100% 3 / 3 totaltotal 81.2% 26 / 32 CC 2 SCAR 8.9
CC
2
Cov
78%
__ANON__
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.4
« DHCPd/Config/SharedNetwork.pm ↑ Summary DHCPd/Config/OptionCode.pm »
1 package Net::ISC::DHCPd::Config::Subnet6;
2  
3 =head1 NAME
4  
5 Net::ISC::DHCPd::Config::Subnet6 - Subnet6 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 subnet6 $address_attribute_value {
15 $options_attribute_value
16 $filename_attribute_value
17 $range_attribute_value
18 $pool_attribute_value
19 $hosts_attribute_value
20 }
21  
22 =head1 SYNOPSIS
23  
24 See L<Net::ISC::DHCPd::Config/SYNOPSIS>.
25  
26 =cut
27  
28 27 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 27 ▶use NetAddr::IP qw(:lower);
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 27 with 'Net::ISC::DHCPd::Config::Role';
32  
33 =head2 children
34  
35 See L<Net::ISC::DHCPd::Config::Role/children>.
36  
37 =cut
38 31 ▶sub children {
Subroutine children: called CC=1 SCAR=0.0
Pod documented
39 31 return qw/
40 Net::ISC::DHCPd::Config::Conditional
41 Net::ISC::DHCPd::Config::Host
42 Net::ISC::DHCPd::Config::Pool
43 Net::ISC::DHCPd::Config::Range6
44 Net::ISC::DHCPd::Config::Filename
45 Net::ISC::DHCPd::Config::Option
46 Net::ISC::DHCPd::Config::Class
47 Net::ISC::DHCPd::Config::KeyValue
48 Net::ISC::DHCPd::Config::Block
49 /;
50 }
51  
52 27 __PACKAGE__->create_children(__PACKAGE__->children());
53  
54 =head1 ATTRIBUTES
55  
56 =head2 options
57  
58 A list of parsed L<Net::ISC::DHCPd::Config::Option> objects.
59  
60 =head2 ranges
61  
62 A list of parsed L<Net::ISC::DHCPd::Config::Range> objects.
63  
64 =head2 hosts
65  
66 A list of parsed L<Net::ISC::DHCPd::Config::Host> objects.
67  
68 =head2 filenames
69  
70 A list of parsed L<Net::ISC::DHCPd::Config::Filename> objects. There can
71 be only be one node in this list.
72  
73 =cut
74  
75 0 ▶before add_filename => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
76 0 ▶ if(0 < int @{ $_[0]->filenames }) {
Branch: 1 branch
BranchTrueFalseTotal
if (0 < int @{$_[0]->filenames;}) 0 0 0
77 0 confess 'Subnet6 cannot have more than one filename';
78 }
79 27 };
80  
81 =head2 pools
82  
83 A list of parsed L<Net::ISC::DHCPd::Config::Pool> objects.
84  
85 =head2 address
86  
87 This attribute holds an instance of L<NetAddr::IP>, and represents
88 the ip address of this subnet.
89  
90 =cut
91  
92 27 has address => (
93 is => 'ro',
94 isa => 'Object',
95 );
96  
97 =head2 regex
98  
99 See L<Net::ISC::DHCPd::Config/regex>.
100  
101 =cut
102  
103 27 our $regex = qr{^ \s* subnet6 \s+ (\S+) }x;
104  
105 =head1 METHODS
106  
107 =head2 captured_to_args
108  
109 See L<Net::ISC::DHCPd::Config::Role/captured_to_args>.
110  
111 =cut
112  
113 1 ▶sub captured_to_args {
Subroutine captured_to_args: called CC=1 SCAR=0.0
Pod documented
114 1 return { address => NetAddr::IP->new($_[0]) };
115 }
116  
117 =head2 generate
118  
119 See L<Net::ISC::DHCPd::Config::Role/generate>.
120  
121 =cut
122  
123 1 ▶sub generate {
Subroutine generate: called CC=1 SCAR=0.0
Pod documented
124 1 my $self = shift;
125 1 my $net = $self->address;
126  
127 return(
128 1 'subnet6 ' .$net->short() .'/' . $net->masklen() . ' {',
129 $self->_generate_config_from_children,
130 '}',
131 );
132 }
133  
134 =head1 COPYRIGHT & LICENSE
135  
136 =head1 AUTHOR
137  
138 See L<Net::ISC::DHCPd>.
139  
140 =cut
141 27 __PACKAGE__->meta->make_immutable;
142 27 1;
« DHCPd/Config/SharedNetwork.pm ↑ Summary DHCPd/Config/OptionCode.pm »