| 1 | package DNS::Oterica::NodeFamily; | ||
| 2 | # ABSTRACT: a group of hosts that share common functions | ||
| 3 | 1 | $DNS::Oterica::NodeFamily::VERSION = '0.313'; | |
| 4 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 | 0 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 16 | 1 | 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 | ▶ | my ($self, $node) = @_; |
|
Subroutine
add_node: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 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 | ▶ | my ($self) = @_; |
|
Subroutine
as_data_lines: not called CC=2 SCAR=17.9
Pod
documented
| |||
| 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 | 1 | with 'DNS::Oterica::Role::HasHub'; | |
| 59 | |||
| 60 | 1 | __PACKAGE__->meta->make_immutable; | |
| 61 | 1 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 62 | 1 | 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.313 | ||
| 77 | |||
| 78 | =head1 PERL VERSION | ||
| 79 | |||
| 80 | This library should run on perls released even a long time ago. It should work | ||
| 81 | on any version of perl released in the last five years. | ||
| 82 | |||
| 83 | Although it may work on older versions of perl, no guarantee is made that the | ||
| 84 | minimum required version will not be increased. The version may be increased | ||
| 85 | for any reason, and there is no promise that patches will be accepted to lower | ||
| 86 | the minimum required perl. | ||
| 87 | |||
| 88 | =head1 ATTRIBUTES | ||
| 89 | |||
| 90 | =head2 nodes | ||
| 91 | |||
| 92 | This is an arrayref of the node objects that are in this family. | ||
| 93 | |||
| 94 | =head1 METHODS | ||
| 95 | |||
| 96 | =head2 add_node | ||
| 97 | |||
| 98 | $family->add_node($node); | ||
| 99 | |||
| 100 | This adds the given node to the family. | ||
| 101 | |||
| 102 | =head2 as_data_lines | ||
| 103 | |||
| 104 | This method returns a list of lines of configuration. By default it only | ||
| 105 | generates begin and end marking comments. This method is meant to be augmented | ||
| 106 | by subclasses. | ||
| 107 | |||
| 108 | =head1 AUTHOR | ||
| 109 | |||
| 110 | Ricardo SIGNES <rjbs@semiotic.systems> | ||
| 111 | |||
| 112 | =head1 COPYRIGHT AND LICENSE | ||
| 113 | |||
| 114 | This software is copyright (c) 2021 by Ricardo SIGNES. | ||
| 115 | |||
| 116 | This is free software; you can redistribute it and/or modify it under | ||
| 117 | the same terms as the Perl 5 programming language system itself. | ||
| 118 | |||
| 119 | =cut | ||