Usul/Config/Programs.pm

filter: Statementstmt 96.6% 58 / 60 Branchbran 50.0% 2 / 4 Conditioncond 12.5% 1 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 93.7% 15 / 16 Podpod n/a totaltotal 82.6% 76 / 92 CC 7 SCAR 6.2
CC
7
Cov
85%
__ANON__
3.6
_build_os
3.6
__ANON__
2.5
CRAP 1.9
« Usul/Constants.pm ↑ Summary Usul.pm »
1 package Class::Usul::Config::Programs;
2  
3 18 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 18 ▶use Class::Usul::Constants qw( TRUE UMASK );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 18 ▶use Class::Usul::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 18 ▶use Class::Usul::Types qw( ArrayRef Bool HashRef NonEmptySimpleStr
Subroutine BEGIN: called CC=1 SCAR=0.0
8 18 NonZeroPositiveInt PositiveInt );
9 18 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 18 ▶use File::Basename qw( basename );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 18 ▶use File::DataClass::Types qw( Path OctalNum );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 18 ▶use File::HomeDir;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 18 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 9 extends q(Class::Usul::Config);
16  
17 # Attribute constructors
18 1 ▶my $_build_os = sub {
Subroutine __ANON__: called CC=3 SCAR=12.7
Subroutine _build_os: called CC=3 SCAR=12.7
19 1 my $self = shift;
20 1 my $file = 'os_'.$Config{osname}.$self->extension;
21 1 ▶ my $path = $self->ctrldir->catfile( $file ); $path->exists or return {};
Branch: 2 branches
BranchTrueFalseTotal
$path->exists or return {} 0 1 1
$path->exists or return {} 0 1 1
22 0 my $conf = Class::Usul::File->data_load( paths => [ $path ] );
23  
24 0 ▶ return $conf->{os} // {};
Condition0%0/4
$conf->{"os"} // {}
l!l
00
$conf->{"os"} // {}
l!l
00
MC/DC0%0/1
$conf->{"os"} // {}
$conf->{"os"}
MC/DC0%0/1
$conf->{"os"} // {}
$conf->{"os"}
Truth table0%0/2
A
A= $conf->{"os"}
Aresult
11
00
Truth table0%0/2
A
A= $conf->{"os"}
Aresult
11
00
25 9 };
26  
27 1 ▶my $_build_owner = sub {
Subroutine __ANON__: called CC=2 SCAR=9.2
Subroutine _build_owner: not called CC=2 SCAR=9.2
28 1 ▶ return $_[ 0 ]->inflate_symbol( $_[ 1 ], 'prefix' ) || 'root';
Condition25%1/4
$_[0]->inflate_symbol($_[1], 'prefix') || 'root'
l!l
10
$_[0]->inflate_symbol($_[1], 'prefix') || 'root'
l!l
00
MC/DC0%0/1
$_[0]->inflate_symbol($_[1], 'prefix') || 'root'
$_[0]->inflate_symbol($_[1], 'prefix')
MC/DC0%0/1
$_[0]->inflate_symbol($_[1], 'prefix') || 'root'
$_[0]->inflate_symbol($_[1], 'prefix')
Truth table50%1/2
A
A= $_[0]->inflate_symbol($_[1], 'prefix')
Aresult
11
00
Truth table0%0/2
A
A= $_[0]->inflate_symbol($_[1], 'prefix')
Aresult
11
00
29 9 };
30  
31 2 ▶my $_build_script = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
32 2 return basename( $_[ 0 ]->inflate_path( $_[ 1 ], 'pathname' ) );
33 9 };
34  
35 # Public attributes
36 9 has 'doc_title' => is => 'ro', isa => NonEmptySimpleStr,
37 default => 'User Contributed Documentation';
38  
39 has 'man_page_cmd' => is => 'ro', isa => ArrayRef,
40 22 ▶ builder => sub { [ 'nroff', '-man' ] };
Subroutine _build_man_page_cmd: called CC=1 SCAR=0.0
41  
42 has 'my_home' => is => 'lazy', isa => Path, coerce => TRUE,
43 1 ▶ builder => sub { File::HomeDir->my_home };
Subroutine _build_my_home: called CC=1 SCAR=0.0
44  
45 9 has 'os' => is => 'lazy', isa => HashRef, builder => $_build_os;
46  
47 9 has 'owner' => is => 'lazy', isa => NonEmptySimpleStr,
48 builder => $_build_owner;
49  
50 9 has 'pwidth' => is => 'ro', isa => NonZeroPositiveInt, default => 60;
51  
52 9 has 'script' => is => 'lazy', isa => NonEmptySimpleStr,
53 builder => $_build_script;
54  
55 9 has 'umask' => is => 'ro', isa => OctalNum, coerce => TRUE,
56 default => UMASK;
57  
58 9 1;
59  
60 __END__
« Usul/Constants.pm ↑ Summary Usul.pm »