Config.pm

filter: Statementstmt 55.1% 27 / 49 Branchbran 8.3% 1 / 12 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 70.0% 7 / 10 Podpod 0.0% 0 / 5 totaltotal 44.4% 36 / 81 CC 9 SCAR 22.7
CC
9
Cov
45%
delete
20.0
statements
20.0
add
2.1
CRAP 9.7
« Config/File/Bind9.pm ↑ Summary Config/Statement/Options.pm »
1 #!/usr/local/bin/perl -w
2 ######################################################################
3 #
4 # DNS/Config.pm
5 #
6 # $Id: Config.pm,v 1.4 2003/02/16 10:15:31 awolf Exp $
7 # $Revision: 1.4 $
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;
19  
20 2 ▶no warnings 'portable';
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use 5.6.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 2 my $VERSION = '0.66';
26 2 my $REVISION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/);
27  
28 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod undocumented
29 1 my($pkg) = @_;
30 1 ▶ my $class = ref($pkg) || $pkg;
Condition33%1/3
ref $pkg || $pkg
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $pkg || $pkg
ref $pkg $pkg
Truth table33%1/3
A || B
A= ref $pkgB= $pkg
ABresult
1X1
011
000
31  
32 1 my $self = {
33 'STATEMENTS' => []
34 };
35
36 1 bless $self, $class;
37
38 1 return $self;
39 }
40  
41 1 ▶sub add {
Subroutine add: called CC=2 SCAR=7.6
Pod undocumented
42 1 my($self, $statement) = @_;
43
44 1 ▶ if(ref($statement) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $statement eq 'ARRAY') { } 0 1 1
45 0 push @{ $self->{'STATEMENTS'} }, @$statement;
46 }
47 else {
48 1 push @{ $self->{'STATEMENTS'} }, ($statement);
49 }
50
51 1 return $self;
52 }
53  
54 0 ▶sub delete {
Subroutine delete: not called CC=4 SCAR=30.0
Pod undocumented
55 0 my($self, $statement) = @_;
56  
57 0 ▶ for(my $i=0 ; $i < scalar @{$self->{'STATEMENTS'}} ; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @{$self->{"STATEMENTS"};}) 0 0 0
58 0 ▶ next unless( defined( $self->{'STATEMENTS'}->[$i] ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"STATEMENTS"}[$i] 0 0 0
59 0 ▶ splice @{ $self->{'STATEMENTS'} }, $i, 1 if($self->{'STATEMENTS'}->[$i] == $statement);
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"STATEMENTS"}[$i] == $statement 0 0 0
60 }
61
62 0 return $self;
63 }
64  
65 0 ▶sub debug {
Subroutine debug: not called CC=1 SCAR=1.7
Pod undocumented
66 0 my($self) = @_;
67
68 0 eval {
69 2 ▶ use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
70
71 0 print Dumper($self);
72 };
73  
74 0 return;
75 }
76  
77 0 ▶sub statements {
Subroutine statements: not called CC=4 SCAR=30.0
Pod undocumented
78 0 my($self, $type) = @_;
79 0 my @result;
80  
81 0 ▶ if($type) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type) { } 0 0 0
82 0 foreach (@{ $self->{'STATEMENTS'} }) {
83 0 ▶ push @result, $_ if(ref($_) eq $type);
Branch: 1 branch
BranchTrueFalseTotal
if ref $_ eq $type 0 0 0
84 }
85 }
86 else {
87 0 @result = @{ $self->{'STATEMENTS'} };
88 }
89
90 0 return @result;
91 }
92  
93 2 1;
94  
95 __END__
« Config/File/Bind9.pm ↑ Summary Config/Statement/Options.pm »