Text/Configuration.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 5 totaltotal 80.4% 37 / 46 CC 3 SCAR 4.3
CC
3
Cov
93%
configuration_from_file
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Text.pm ↑ Summary Text/Regexp.pm »
1 package
2 Twitter::Text::Configuration; # hide from PAUSE
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use JSON ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Path::Tiny qw(path);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use File::Share qw(dist_file);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # internal use only, do not use this module directly.
10  
11 4 my %config_cache;
12  
13 60 ▶sub configuration_from_file {
Subroutine configuration_from_file: called CC=3 SCAR=11.4
Pod undocumented
14 60 my $config_name = shift;
15  
16 60 ▶ return $config_cache{$config_name} if exists $config_cache{$config_name};
Branch: 1 branch
BranchTrueFalseTotal
if exists $config_cache{$config_name} 57 3 60
17  
18 3 ▶ return $config_cache{$config_name} ||= JSON::decode_json(path(dist_file('Twitter-Text', "config/$config_name.json"))->slurp);
Condition33%1/3
$config_cache{$config_name} ||= &JSON::decode_json(scalar path(dist_file("Twitter-Text", "config/$config_name.json"))->slurp)
l!l&&r!l&&!r
030
MC/DC0%0/2
$config_cache{$config_name} ||= &JSON::decode_json(scalar path(dist_file("Twitter-Text", "config/$config_name.json"))->slurp)
$config_cache{$config_name} &JSON::decode_json(scalar path(dist_file("Twitter-Text", "config/$config_name.json"))->slurp)
Truth table33%1/3
A ||= B
A= $config_cache{$config_name}B= &JSON::decode_json(scalar path(dist_file("Twitter-Text", "config/$config_name.json"))->slurp)
ABresult
1X1
011
000
19 }
20  
21 8 ▶sub V1 {
Subroutine V1: called CC=1 SCAR=0.0
Pod undocumented
22 8 return configuration_from_file('v1');
23 }
24  
25 28 ▶sub V2 {
Subroutine V2: called CC=1 SCAR=0.0
Pod undocumented
26 28 return configuration_from_file('v2');
27 }
28  
29 24 ▶sub V3 {
Subroutine V3: called CC=1 SCAR=0.0
Pod undocumented
30 24 return configuration_from_file('v3');
31 }
32  
33 24 ▶sub default_configuration {
Subroutine default_configuration: called CC=1 SCAR=0.0
Pod undocumented
34 24 return V3;
35 }
36  
37 4 1;
« Text.pm ↑ Summary Text/Regexp.pm »