DNS::Oterica::NodeFamily - a group of hosts that share common functions


DNS-Oterica documentation Contained in the DNS-Oterica distribution.

Index


Code Index:

NAME

Top

DNS::Oterica::NodeFamily - a group of hosts that share common functions

VERSION

Top

version 0.100001

ATTRIBUTES

Top

nodes

This is an arrayref of the node objects that are in this family.

hub

This is the hub object into which the family was registered.

METHODS

Top

add_node

  $family->add_node($node);

This adds the given node to the family.

as_data_lines

This method returns a list of lines of configuration. By default it only generates begin and end marking comments. This method is meant to be augmented by subclasses.

AUTHOR

Top

Ricardo SIGNES <rjbs@cpan.org>

COPYRIGHT AND LICENSE

Top


DNS-Oterica documentation Contained in the DNS-Oterica distribution.

package DNS::Oterica::NodeFamily;
BEGIN {
  $DNS::Oterica::NodeFamily::VERSION = '0.100001';
}
# ABSTRACT: a group of hosts that share common functions
use Moose;


has nodes => (
  isa => 'ArrayRef',
  init_arg   => undef,
  default    => sub { [] },
  traits   => [ 'Array' ],
  handles  => {
    nodes      => 'elements',
    _push_node => 'push',
  },
);


# XXX: do not allow dupes -- rjbs, 2009-09-11
sub add_node {
  my ($self, $node) = @_;

  $self->_push_node( $node );
}


sub as_data_lines {
  my ($self) = @_;

  my @lines;

  push @lines, $self->rec->comment("begin family " . $self->name);
  push @lines, $_ for inner();
  push @lines, $self->rec->comment("end family " . $self->name);

  return @lines;
}


has hub => (
  is   => 'ro',
  isa  => 'DNS::Oterica::Hub',
  weak_ref => 1,
  required => 1,
  # handles  => 'DNS::Oterica::Role::RecordMaker',
  handles  => [ qw(rec) ],
);

__PACKAGE__->meta->make_immutable;
no Moose;
1;

__END__