DHCPd/Config/Class.pm

filter: Statementstmt 100% 13 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 3 / 3 totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
children
1.0
captured_to_args
1.0
CRAP 1.0
« DHCPd/Config/Authoritative.pm ↑ Summary DHCPd/Config/Filename.pm »
1 package Net::ISC::DHCPd::Config::Class;
2  
3 =head1 NAME
4  
5 Net::ISC::DHCPd::Config::Class - Class 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 the block below:
13  
14 class "$name" {
15 ...
16 }
17  
18 =head1 SYNOPSIS
19  
20 See L<Net::ISC::DHCPd::Config/SYNOPSIS>.
21  
22 =cut
23  
24 27 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 27 with 'Net::ISC::DHCPd::Config::Role';
27  
28 =head1 ATTRIBUTES
29  
30 =head2 name
31  
32 Name of the key - See L</DESCRIPTION> for details.
33  
34 =head2 algorithm
35  
36 =head2 secret
37  
38 =cut
39  
40 27 has [qw/ name /] => (
41 is => 'rw',
42 isa => 'Str',
43 );
44  
45 =head2 children
46  
47 See L<Net::ISC::DHCPd::Config::Role/children>.
48  
49 =cut
50 # match will get treated as a KeyValue
51 56 ▶sub children {
Subroutine children: called CC=1 SCAR=0.0
Pod documented
52 56 return qw/
53 Net::ISC::DHCPd::Config::Option
54 Net::ISC::DHCPd::Config::KeyValue
55 /;
56 }
57 27 __PACKAGE__->create_children(__PACKAGE__->children());
58  
59  
60 =head2 regex
61  
62 See L<Net::ISC::DHCPd::Config::Role/regex>.
63  
64 =cut
65 27 our $regex = qr{^\s* class \s+ (")?(.*?)(\1|$) }x;
66  
67 =head1 METHODS
68  
69 =head2 captured_to_args
70  
71 See L<Net::ISC::DHCPd::Config::Role/captured_to_args>.
72  
73 =cut
74  
75 8 ▶sub captured_to_args {
Subroutine captured_to_args: called CC=1 SCAR=0.0
Pod documented
76 8 return { name => $_[1] }; # $_[0] == quote or empty string
77 }
78  
79 =head2 generate
80  
81 See L<Net::ISC::DHCPd::Config::Role/generate>.
82  
83 =cut
84  
85 2 ▶sub generate {
Subroutine generate: called CC=1 SCAR=0.0
Pod documented
86 2 my $self = shift;
87 2 return sprintf('class "%s" {', $self->name), $self->_generate_config_from_children, '}';
88 }
89  
90 =head1 COPYRIGHT & LICENSE
91  
92 =head1 AUTHOR
93  
94 See L<Net::ISC::DHCPd>.
95  
96 =cut
97 27 __PACKAGE__->meta->make_immutable;
98 27 1;
« DHCPd/Config/Authoritative.pm ↑ Summary DHCPd/Config/Filename.pm »