line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Handle bundle of changes |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2005,2008,2011,2013 Patrick Mevzek . All rights reserved. |
4
|
|
|
|
|
|
|
## |
5
|
|
|
|
|
|
|
## This file is part of Net::DRI |
6
|
|
|
|
|
|
|
## |
7
|
|
|
|
|
|
|
## Net::DRI is free software; you can redistribute it and/or modify |
8
|
|
|
|
|
|
|
## it under the terms of the GNU General Public License as published by |
9
|
|
|
|
|
|
|
## the Free Software Foundation; either version 2 of the License, or |
10
|
|
|
|
|
|
|
## (at your option) any later version. |
11
|
|
|
|
|
|
|
## |
12
|
|
|
|
|
|
|
## See the LICENSE file that comes with this distribution for more details. |
13
|
|
|
|
|
|
|
######################################################################################### |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Net::DRI::Data::Changes; |
16
|
|
|
|
|
|
|
|
17
|
69
|
|
|
69
|
|
1026
|
use strict; |
|
69
|
|
|
|
|
89
|
|
|
69
|
|
|
|
|
1713
|
|
18
|
69
|
|
|
69
|
|
214
|
use warnings; |
|
69
|
|
|
|
|
103
|
|
|
69
|
|
|
|
|
34479
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=pod |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Net::DRI::Data::Changes - Bundle of changes in Net::DRI |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Please see the README file for details. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SUPPORT |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
For now, support questions should be sent to: |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Enetdri@dotandco.comE |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Please also see the SUPPORT file in the distribution. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 SEE ALSO |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Ehttp://www.dotandco.com/services/software/Net-DRI/E |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 AUTHOR |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Patrick Mevzek, Enetdri@dotandco.comE |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 COPYRIGHT |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Copyright (c) 2005,2008,2011,2013 Patrick Mevzek . |
49
|
|
|
|
|
|
|
All rights reserved. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
52
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
53
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
54
|
|
|
|
|
|
|
(at your option) any later version. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
See the LICENSE file that comes with this distribution for more details. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
############################################################################################################################## |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub new |
63
|
|
|
|
|
|
|
{ |
64
|
10
|
|
|
10
|
0
|
26
|
my ($class,$type,$op,$el)=@_; |
65
|
|
|
|
|
|
|
|
66
|
10
|
|
|
|
|
11
|
my $self={}; ## { 'type' => [ toadd, todel, toset ] } type=host,ip,status,contact,etc... |
67
|
10
|
|
|
|
|
13
|
bless($self,$class); |
68
|
|
|
|
|
|
|
|
69
|
10
|
50
|
66
|
|
|
48
|
if (defined($type) && defined($op) && defined($el)) |
|
|
|
66
|
|
|
|
|
70
|
|
|
|
|
|
|
{ |
71
|
6
|
|
|
|
|
11
|
$self->{$type}=[]; |
72
|
6
|
100
|
|
|
|
26
|
$self->{$type}->[0]=$el if ($op=~m/^(?:0|add)$/); |
73
|
6
|
100
|
|
|
|
18
|
$self->{$type}->[1]=$el if ($op=~m/^(?:1|del)$/); |
74
|
6
|
100
|
|
|
|
23
|
$self->{$type}->[2]=$el if ($op=~m/^(?:2|set)$/); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
10
|
|
|
|
|
21
|
return $self; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
1
|
0
|
3
|
sub new_add { return shift->new(shift,'add',shift); } |
81
|
1
|
|
|
1
|
0
|
3
|
sub new_del { return shift->new(shift,'del',shift); } |
82
|
1
|
|
|
1
|
0
|
3
|
sub new_set { return shift->new(shift,'set',shift); } |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub types |
85
|
|
|
|
|
|
|
{ |
86
|
34
|
|
|
34
|
0
|
2454
|
my ($self,$type)=@_; |
87
|
34
|
100
|
|
|
|
59
|
if (! defined $type) |
88
|
|
|
|
|
|
|
{ |
89
|
18
|
|
|
|
|
58
|
my @r=sort { $a cmp $b } keys %$self; |
|
4
|
|
|
|
|
7
|
|
90
|
18
|
|
|
|
|
59
|
return @r; |
91
|
|
|
|
|
|
|
} |
92
|
16
|
|
|
|
|
19
|
my @r; |
93
|
16
|
100
|
66
|
|
|
66
|
return @r unless (exists($self->{$type}) && defined($self->{$type})); |
94
|
13
|
100
|
|
|
|
55
|
push @r,'add' if (defined($self->{$type}->[0])); |
95
|
13
|
100
|
|
|
|
22
|
push @r,'del' if (defined($self->{$type}->[1])); |
96
|
13
|
100
|
|
|
|
21
|
push @r,'set' if (defined($self->{$type}->[2])); |
97
|
13
|
|
|
|
|
49
|
return @r; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub _el |
101
|
|
|
|
|
|
|
{ |
102
|
38
|
|
|
38
|
|
42
|
my ($self,$pos,$type,$new)=@_; |
103
|
38
|
100
|
|
|
|
63
|
unless (defined($new)) |
104
|
|
|
|
|
|
|
{ |
105
|
30
|
100
|
66
|
|
|
99
|
return unless (exists($self->{$type}) && defined($self->{$type})); |
106
|
24
|
|
|
|
|
63
|
return $self->{$type}->[$pos]; |
107
|
|
|
|
|
|
|
} |
108
|
8
|
100
|
|
|
|
23
|
$self->{$type}=[] unless (exists($self->{$type})); |
109
|
8
|
|
|
|
|
10
|
$self->{$type}->[$pos]=$new; |
110
|
|
|
|
|
|
|
|
111
|
8
|
|
|
|
|
10
|
return $self; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
16
|
|
|
16
|
0
|
29
|
sub add { return shift->_el(0,shift,shift); } |
115
|
16
|
|
|
16
|
0
|
31
|
sub del { return shift->_el(1,shift,shift); } |
116
|
6
|
|
|
6
|
0
|
13
|
sub set { return shift->_el(2,shift,shift); } |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub all_defined |
119
|
|
|
|
|
|
|
{ |
120
|
20
|
|
|
20
|
0
|
23
|
my ($self,$type)=@_; |
121
|
20
|
100
|
66
|
|
|
152
|
return () unless (defined($type) && $type && exists($self->{$type}) && defined($self->{$type})); |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
122
|
10
|
|
|
|
|
9
|
return (grep { defined } @{$self->{$type}}); |
|
18
|
|
|
|
|
47
|
|
|
10
|
|
|
|
|
16
|
|
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub is_empty |
126
|
|
|
|
|
|
|
{ |
127
|
3
|
|
|
3
|
0
|
3
|
my $self=shift; |
128
|
3
|
|
|
|
|
7
|
my @o=map { $self->all_defined($_) } $self->types(); |
|
3
|
|
|
|
|
7
|
|
129
|
3
|
50
|
|
|
|
19
|
return @o? 0 : 1; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
############################################################################################################################## |
133
|
|
|
|
|
|
|
1; |