blib/lib/Net/ISC/DHCPd/Config/Class.pm untested

filter: Statementstmt 0.0% 0 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 20 SCAR 6.9
CC
1
Cov
0%
children
2.0
captured_to_args
2.0
generate
2.0
CRAP 2.0
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 use Moose;
25  
26 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 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 sub children {
52 return qw/
53 Net::ISC::DHCPd::Config::Option
54 Net::ISC::DHCPd::Config::KeyValue
55 /;
56 }
57 __PACKAGE__->create_children(__PACKAGE__->children());
58  
59  
60 =head2 regex
61  
62 See L<Net::ISC::DHCPd::Config::Role/regex>.
63  
64 =cut
65 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 sub captured_to_args {
76 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 sub generate {
86 my $self = shift;
87 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 __PACKAGE__->meta->make_immutable;
98 1;