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