Config/Statement/Options.pm

filter: Statementstmt 71.7% 38 / 53 Branchbran 33.3% 2 / 6 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.0% 8 / 10 Podpod 0.0% 0 / 4 totaltotal 59.0% 49 / 83 CC 8 SCAR 18.8
CC
8
Cov
63%
dump
20.0
directory
6.0
parse_tree
3.0
CRAP 6.5
« Config.pm ↑ Summary Config/File.pm »
1 #!/usr/local/bin/perl -w
2 ######################################################################
3 #
4 # DNS/Config/Statement/Options.pm
5 #
6 # $Id: Options.pm,v 1.3 2003/02/16 10:15:33 awolf Exp $
7 # $Revision: 1.3 $
8 # $Author: awolf $
9 # $Date: 2003/02/16 10:15:33 $
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::Options;
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 2 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 2 ▶use DNS::Config::Statement;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 2 @ISA = qw(DNS::Config::Statement);
29  
30 2 my $VERSION = '0.66';
31 2 my $REVISION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
32  
33 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod undocumented
34 1 my($pkg) = @_;
35 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
36  
37 1 my $self = {};
38
39 1 bless $self, $class;
40  
41 1 return $self;
42 }
43  
44 1 ▶sub parse_tree {
Subroutine parse_tree: called CC=3 SCAR=11.0
Pod undocumented
45 1 my($self, @array) = @_;
46  
47 1 my $data = shift @array;
48 1 my @data = @$data;
49  
50 1 foreach my $stmt (@data) {
51 3 my @stmt = @$stmt;
52
53 3 my $key = uc shift @stmt;
54
55 3 ▶ if(scalar(@stmt) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @stmt == 1) { } 2 1 3
56 2 $self->{$key} = shift @stmt;
57 2 $self->{$key} =~ s/^\"//g;
58 2 $self->{$key} =~ s/\"$//g;
59 }
60 else {
61 1 $self->{$key} = \@stmt;
62 }
63 }
64
65 1 return $self
66 }
67  
68 0 ▶sub dump {
Subroutine dump: not called CC=4 SCAR=30.0
Pod undocumented
69 0 my($self) = @_;
70 0 my @array;
71  
72 my @array2;
73 0 foreach my $key (keys %$self) {
74 0 ▶ if(($key =~ /FILE/) || ($key =~ /DIRECTORY/)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key =~ /FILE/ or $key =~ /DIRECTORY/) { } 0 0 0
Condition0%0/3
$key =~ /FILE/ or $key =~ /DIRECTORY/
l!l&&r!l&&!r
000
MC/DC0%0/2
$key =~ /FILE/ or $key =~ /DIRECTORY/
$key =~ /FILE/ $key =~ /DIRECTORY/
Truth table0%0/3
A or B
A= $key =~ /FILE/B= $key =~ /DIRECTORY/
ABresult
1X1
011
000
75 0 push @array2, ([ lc $key, q(") . $self->{$key} . q(")]);
76 }
77 else {
78 0 push @array2, ([ lc $key, $self->{$key}]);
79 }
80 }
81
82 0 push @array, ('options', \@array2 );
83
84 0 my $string = $self->substatement(@array);
85 0 print $string, "\n";
86  
87 0 return $self;
88 }
89  
90 0 ▶sub directory {
Subroutine directory: not called CC=2 SCAR=17.9
Pod undocumented
91 0 my($self) = @_;
92
93 0 my $directory;
94 0 ▶ if(exists $self->{'DIRECTORY'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"DIRECTORY"}) 0 0 0
95 0 $directory = $self->{'DIRECTORY'};
96 }
97
98 0 return $directory;
99 }
100  
101 2 1;
102  
103 __END__
« Config.pm ↑ Summary Config/File.pm »