Build/Built.pm

filter: Statementstmt 91.1% 41 / 45 Branchbran 62.5% 10 / 16 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 92.3% 12 / 13 Podpod 100% 7 / 7 totaltotal 84.8% 73 / 86 CC 10 SCAR 11.7
CC
10
Cov
83%
run_env
6.3
new
4.3
combined_man_path
2.3
CRAP 3.2
« Build.pm ↑ Summary
1 package Perl::Build::Built;
2  
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 utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 our $VERSION = '1.34';
9  
10 4 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use File::Spec::Functions qw( catdir catfile );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶sub run_env {
Subroutine run_env: called CC=6 SCAR=18.4
Pod documented
14 2 my ( $self, @args ) = @_;
15 2 my $config = {};
16 2 ▶ if ( ref $args[0] eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $args[0] eq "HASH") 0 2 2
17 0 $config = %{ shift @args };
18 }
19 2 ▶ if ( $args[0] and ref $args[0] eq 'CODE' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[0] and ref $args[0] eq "CODE") 1 1 2
Condition66%2/3
$args[0] and ref $args[0] eq "CODE"
!ll&&!rl&&r
011
MC/DC50%1/2
$args[0] and ref $args[0] eq "CODE"
$args[0] ref $args[0] eq "CODE"
Truth table66%2/3
A and B
A= $args[0]B= ref $args[0] eq "CODE"
ABresult
0X0
100
111
20 1 $config->{code} = shift @args;
21 }
22 2 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 1 1 2
23 1 Carp::croak( '->run_env(\%config,\&code)'
24 . ' or ->run_env(\&code)'
25 . ' or ->run_env(\%config)' );
26 }
27 1 local $ENV{PATH} = $self->combined_bin_path;
28 1 my $combined_man_path = $self->combined_man_path;
29 1 ▶ local $ENV{MANPATH} = $combined_man_path if $combined_man_path;
Branch: 1 branch
BranchTrueFalseTotal
if $combined_man_path 0 1 1
30 1 delete local $ENV{PERL5LIB};
31 1 return $config->{code}->();
32 }
33  
34 1 ▶sub new {
Subroutine new: called CC=4 SCAR=14.6
Pod documented
35 1 my ( $self, $args ) = @_;
36 1 ▶ $args = {} unless defined $args;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args 0 1 1
37 1 ▶ Carp::croak '->new(\%config) required' if not ref $args eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args eq "HASH" 0 1 1
38 Carp::croak 'installed_path is a mandatory parameter'
39 1 ▶ unless exists $args->{installed_path};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args->{"installed_path"} 0 1 1
40 1 return bless $args, $self;
41 }
42  
43 0 ▶sub installed_path {
Subroutine installed_path: not called CC=1 SCAR=6.9
Pod documented
44 0 return $_[0]->{installed_path};
45 }
46  
47 1 ▶sub bin_path {
Subroutine bin_path: called CC=1 SCAR=0.0
Pod documented
48 1 return catdir( $_[0]->{installed_path}, 'bin' );
49 }
50  
51 2 ▶sub man_path {
Subroutine man_path: called CC=1 SCAR=0.0
Pod documented
52 2 return catdir( $_[0]->{installed_path}, 'man' );
53 }
54  
55 1 ▶sub combined_bin_path {
Subroutine combined_bin_path: called CC=1 SCAR=0.0
Pod documented
56 1 return $_[0]->bin_path . ':' . $ENV{PATH};
57 }
58  
59 2 ▶sub combined_man_path {
Subroutine combined_man_path: called CC=2 SCAR=8.1
Pod documented
60 2 ▶ if ( -d $_[0]->man_path ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $_[0]->man_path) 0 2 2
61 0 return $_[0]->man_path . ':' . $ENV{MANPATH};
62 }
63 2 return $ENV{MANPATH};
64 }
65  
66 4 1;
67  
68 __END__
« Build.pm ↑ Summary