File Coverage

blib/lib/DNS/Oterica/NodeFamily.pm
Criterion Covered Total %
statement 6 14 42.8
branch n/a
condition n/a
subroutine 2 4 50.0
pod 2 2 100.0
total 10 20 50.0


line stmt bran cond sub pod time code
1             package DNS::Oterica::NodeFamily;
2             # ABSTRACT: a group of hosts that share common functions
3             $DNS::Oterica::NodeFamily::VERSION = '0.303';
4 1     1   4 use Moose;
  1         2  
  1         5  
5              
6             #pod =attr nodes
7             #pod
8             #pod This is an arrayref of the node objects that are in this family.
9             #pod
10             #pod =cut
11              
12             has nodes => (
13             isa => 'ArrayRef',
14             init_arg => undef,
15             default => sub { [] },
16             traits => [ 'Array' ],
17             handles => {
18             nodes => 'elements',
19             _push_node => 'push',
20             },
21             );
22              
23             #pod =method add_node
24             #pod
25             #pod $family->add_node($node);
26             #pod
27             #pod This adds the given node to the family.
28             #pod
29             #pod =cut
30              
31             # XXX: do not allow dupes -- rjbs, 2009-09-11
32             sub add_node {
33 0     0 1   my ($self, $node) = @_;
34              
35 0           $self->_push_node( $node );
36             }
37              
38             #pod =method as_data_lines
39             #pod
40             #pod This method returns a list of lines of configuration. By default it only
41             #pod generates begin and end marking comments. This method is meant to be augmented
42             #pod by subclasses.
43             #pod
44             #pod =cut
45              
46             sub as_data_lines {
47 0     0 1   my ($self) = @_;
48              
49 0           my @lines;
50              
51 0           push @lines, $self->rec->comment("begin family " . $self->name);
52 0           push @lines, $_ for inner();
53 0           push @lines, $self->rec->comment("end family " . $self->name);
54              
55 0           return @lines;
56             }
57              
58             with 'DNS::Oterica::Role::HasHub';
59              
60             __PACKAGE__->meta->make_immutable;
61 1     1   4072 no Moose;
  1         1  
  1         4  
62             1;
63              
64             __END__
65              
66             =pod
67              
68             =encoding UTF-8
69              
70             =head1 NAME
71              
72             DNS::Oterica::NodeFamily - a group of hosts that share common functions
73              
74             =head1 VERSION
75              
76             version 0.303
77              
78             =head1 ATTRIBUTES
79              
80             =head2 nodes
81              
82             This is an arrayref of the node objects that are in this family.
83              
84             =head1 METHODS
85              
86             =head2 add_node
87              
88             $family->add_node($node);
89              
90             This adds the given node to the family.
91              
92             =head2 as_data_lines
93              
94             This method returns a list of lines of configuration. By default it only
95             generates begin and end marking comments. This method is meant to be augmented
96             by subclasses.
97              
98             =head1 AUTHOR
99              
100             Ricardo SIGNES <rjbs@cpan.org>
101              
102             =head1 COPYRIGHT AND LICENSE
103              
104             This software is copyright (c) 2016 by Ricardo SIGNES.
105              
106             This is free software; you can redistribute it and/or modify it under
107             the same terms as the Perl 5 programming language system itself.
108              
109             =cut