line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/local/bin/perl -w |
2
|
|
|
|
|
|
|
###################################################################### |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# DNS/Config/Statement.pm |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# $Id: Statement.pm,v 1.3 2003/02/16 10:15:31 awolf Exp $ |
7
|
|
|
|
|
|
|
# $Revision: 1.3 $ |
8
|
|
|
|
|
|
|
# $Author: awolf $ |
9
|
|
|
|
|
|
|
# $Date: 2003/02/16 10:15:31 $ |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Copyright (C)2001-2003 Andy Wolf. All rights reserved. |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or |
14
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
###################################################################### |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package DNS::Config::Statement; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
2
|
|
12
|
no warnings 'portable'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
86
|
|
21
|
2
|
|
|
2
|
|
24
|
use 5.6.0; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
80
|
|
22
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
73
|
|
23
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1054
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $VERSION = '0.66'; |
26
|
|
|
|
|
|
|
my $REVISION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
0
|
|
|
0
|
0
|
|
my($pkg) = @_; |
30
|
0
|
|
0
|
|
|
|
my $class = ref($pkg) || $pkg; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $self = { |
33
|
|
|
|
|
|
|
'TREE' => [] |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
bless $self, $class; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub parse_tree { |
42
|
0
|
|
|
0
|
0
|
|
my($self, @array) = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
return undef if(scalar(@{ $self->{'TREE'} })); |
|
0
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
push @{ $self->{'TREE'} }, @array; |
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
return $self; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub dump { |
52
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
print $self->substatement(@{ $self->{'TREE'} }); |
|
0
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
print "\n"; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return $self; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub substatement { |
61
|
0
|
|
|
0
|
0
|
|
my($self, @array) = @_; |
62
|
0
|
|
|
|
|
|
my $string; |
63
|
0
|
|
|
|
|
|
my $flags = 0; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $arrays_only = 1; |
66
|
0
|
|
|
|
|
|
foreach my $element (@array) { |
67
|
0
|
0
|
|
|
|
|
$arrays_only = 0 if(ref($element) ne 'ARRAY'); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
$string .= "\{\n" if($arrays_only); |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
foreach my $element (@array) { |
73
|
0
|
0
|
|
|
|
|
if(ref($element) eq 'ARRAY') { |
74
|
0
|
|
|
|
|
|
$string .= $self->substatement(@$element); |
75
|
0
|
|
|
|
|
|
$flags = 0; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
else { |
78
|
0
|
|
|
|
|
|
$string .= "$element "; |
79
|
0
|
|
|
|
|
|
$flags = 1; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
$string .= "\} " if($arrays_only); |
84
|
0
|
0
|
0
|
|
|
|
$string .= "\;\n" if($flags || $arrays_only); |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
return $string; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |