Normal/Config.pm

filter: Statementstmt 100% 60 / 60 Branchbran 100% 6 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 15 / 15 Podpod n/a totaltotal 97.6% 84 / 86 CC 7 SCAR 5.7
CC
7
Cov
99%
_expand
3.0
_attach
3.0
_slurp
2.0
CRAP 1.8
« Normal/Config/BusinessStem.pm ↑ Summary Normal/Type/City.pm »
1 package String::Normal::Config;
2 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 9 ▶use String::Normal::Config::BusinessStem;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 9 ▶use String::Normal::Config::BusinessStop;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 9 ▶use String::Normal::Config::BusinessCompress;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 ▶use String::Normal::Config::AddressStem;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use String::Normal::Config::AddressStop;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 9 ▶use String::Normal::Config::States;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 ▶use String::Normal::Config::AreaCodes;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 9 ▶use String::Normal::Config::TitleStem;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 9 ▶use String::Normal::Config::TitleStop;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 14 ▶sub _slurp {
Subroutine _slurp: called CC=2 SCAR=7.0
16 14 my $fh = shift;
17 14 my @data = ();
18 14 ▶ chomp( @data = map { $_ || () } map { split /\s+/, $_, 2 } <$fh> );
Condition66%2/3
$_ || ()
l!l&&r!l&&!r
67460772
MC/DC50%1/2
$_ || ()
$_ ()
Truth table66%2/3
A || B
A= $_B= ()
ABresult
1X1
011
000
19 14 close $fh;
20 14 return @data;
21 }
22  
23 3 ▶sub _expand_ranges {
Subroutine _expand_ranges: called CC=2 SCAR=6.9
24 3 my @expanded = ();
25  
26 3 for my $line (@_) {
27 625 my @ranges = map { /(\w)-?(\w)/;[$1..$2] } $line =~ /\[(\w-?\w)+\]/g;
28 625 $line =~ s/\[.*//;
29 625 _expand( \my @results, $line, @ranges );
30 625 push @expanded, @results;
31 }
32  
33 3 return @expanded;
34 }
35  
36 1133 ▶sub _expand {
Subroutine _expand: called CC=3 SCAR=11.0
37 1133 my ($results,$str,$car,@cdr) = @_;
38  
39 1133 ▶ if (ref $car ne 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $car ne "ARRAY") 1101 32 1133
40 1101 push @$results, $str;
41 1101 return;
42 }
43  
44 32 for (@$car) {
45 508 _expand( $results, $str . $_, @cdr );
46 };
47 }
48  
49 3338 ▶sub _attach {
Subroutine _attach: called CC=3 SCAR=11.0
50 3338 my ($t, $car, @cdr) = @_;
51 3338 ▶ return unless defined $car;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $car 1101 2237 3338
52 2237 ▶ $t->{$car} = {} unless ref $t->{$car};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $t->{$car} 1325 912 2237
53 2237 _attach( $t->{$car}, @cdr );
54 }
55  
56 9 1;
57  
58 __END__
« Normal/Config/BusinessStem.pm ↑ Summary Normal/Type/City.pm »