line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DNS::Oterica::Node; |
2
|
|
|
|
|
|
|
# ABSTRACT: DNSO node. belongs to families. |
3
|
|
|
|
|
|
|
$DNS::Oterica::Node::VERSION = '0.303'; |
4
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4341
|
use DNS::Oterica::Role::RecordMaker; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
250
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#pod =head1 OVERVIEW |
9
|
|
|
|
|
|
|
#pod |
10
|
|
|
|
|
|
|
#pod A node is any part of a network, either a domain or a node. It is a member of |
11
|
|
|
|
|
|
|
#pod zero or more families. |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod Like other DNS::Oterica objects, they should be created through the hub. |
14
|
|
|
|
|
|
|
#pod |
15
|
|
|
|
|
|
|
#pod =attr domain |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod This is a string representing the domain's domain name, for example |
18
|
|
|
|
|
|
|
#pod F<example.com>. |
19
|
|
|
|
|
|
|
#pod |
20
|
|
|
|
|
|
|
#pod =cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has domain => (is => 'ro', isa => 'Str', required => 1); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#pod =attr families |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod This is an arrayref of the families in which the node has been placed. |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod =cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has families => (is => 'ro', isa => 'ArrayRef', default => sub { [] }); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#pod =method add_to_family |
33
|
|
|
|
|
|
|
#pod |
34
|
|
|
|
|
|
|
#pod $node->add_to_family($family); |
35
|
|
|
|
|
|
|
#pod |
36
|
|
|
|
|
|
|
#pod This method adds the node to the given family, which may be given either as an |
37
|
|
|
|
|
|
|
#pod object or as a name. |
38
|
|
|
|
|
|
|
#pod |
39
|
|
|
|
|
|
|
#pod If the node is already in the family, nothing happens. |
40
|
|
|
|
|
|
|
#pod |
41
|
|
|
|
|
|
|
#pod =cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub add_to_family { |
44
|
0
|
|
|
0
|
1
|
|
my ($self, $family) = @_; |
45
|
0
|
0
|
|
|
|
|
$family = $self->hub->node_family($family) unless ref $family; |
46
|
0
|
0
|
|
|
|
|
return if $self->in_node_family($family); |
47
|
0
|
|
|
|
|
|
$family->add_node($self); |
48
|
0
|
|
|
|
|
|
push @{ $self->families }, $family; |
|
0
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#pod =method in_node_family |
52
|
|
|
|
|
|
|
#pod |
53
|
|
|
|
|
|
|
#pod if ($node->in_node_family($family)) { ... } |
54
|
|
|
|
|
|
|
#pod |
55
|
|
|
|
|
|
|
#pod This method returns true if the node is a member of the named (or passed) |
56
|
|
|
|
|
|
|
#pod family and false otherwise. |
57
|
|
|
|
|
|
|
#pod |
58
|
|
|
|
|
|
|
#pod =cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub in_node_family { |
61
|
0
|
|
|
0
|
1
|
|
my ($self, $family) = @_; |
62
|
0
|
0
|
|
|
|
|
$family = $self->hub->node_family($family) unless ref $family; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
for my $node_family (@{ $self->families }) { |
|
0
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
return 1 if $family == $node_family; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
#pod =method as_data_lines |
72
|
|
|
|
|
|
|
#pod |
73
|
|
|
|
|
|
|
#pod This method returns a list of lines of configuration output. |
74
|
|
|
|
|
|
|
#pod |
75
|
|
|
|
|
|
|
#pod By default, it returns nothing. |
76
|
|
|
|
|
|
|
#pod |
77
|
|
|
|
|
|
|
#pod =cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub as_data_lines { |
80
|
0
|
0
|
|
0
|
1
|
|
confess 'do not call ->as_data_lines in non-list context' unless wantarray; |
81
|
0
|
|
|
|
|
|
return; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
with 'DNS::Oterica::Role::HasHub'; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
87
|
1
|
|
|
1
|
|
4
|
no Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__END__ |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=pod |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=encoding UTF-8 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 NAME |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
DNS::Oterica::Node - DNSO node. belongs to families. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 VERSION |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
version 0.303 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 OVERVIEW |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
A node is any part of a network, either a domain or a node. It is a member of |
107
|
|
|
|
|
|
|
zero or more families. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Like other DNS::Oterica objects, they should be created through the hub. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 domain |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This is a string representing the domain's domain name, for example |
116
|
|
|
|
|
|
|
F<example.com>. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 families |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This is an arrayref of the families in which the node has been placed. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 METHODS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 add_to_family |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
$node->add_to_family($family); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This method adds the node to the given family, which may be given either as an |
129
|
|
|
|
|
|
|
object or as a name. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
If the node is already in the family, nothing happens. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 in_node_family |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
if ($node->in_node_family($family)) { ... } |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This method returns true if the node is a member of the named (or passed) |
138
|
|
|
|
|
|
|
family and false otherwise. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 as_data_lines |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This method returns a list of lines of configuration output. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
By default, it returns nothing. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 AUTHOR |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Ricardo SIGNES <rjbs@cpan.org> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Ricardo SIGNES. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
155
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |