CPAN/Maker/Bootstrapper/Role/DistFile.pm

filter: Statementstmt 65.7% 25 / 38 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 1 totaltotal 51.5% 33 / 64 CC 6 SCAR 29.2
CC
6
Cov
50%
cmd_dist_file
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 18.6
« CPAN/Maker/Bootstrapper/Role/ShowDefaults.pm ↑ Summary CPAN/Maker/Bootstrapper/Role/ScaffoldImporter.pm »
1 package CPAN::Maker::Bootstrapper::Role::DistFile;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use CLI::Simple::Constants qw(:booleans);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use CLI::Simple::Utils qw(slurp);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use English qw(-no_match_vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use File::ShareDir qw(dist_dir);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 ########################################################################
15 0 ▶sub cmd_dist_file {
Subroutine cmd_dist_file: not called CC=6 SCAR=37.4
Pod undocumented
16 ########################################################################
17 0 my ($self) = @_;
18  
19 0 my ( $distribution, $file ) = $self->get_args;
20  
21 0 ▶ die "usage: dist-file distribution file\n"
Branch: 1 branch
BranchTrueFalseTotal
unless $distribution and $file 0 0 0
Condition0%0/3
$distribution and $file
!ll&&!rl&&r
000
MC/DC0%0/2
$distribution and $file
$distribution $file
Truth table0%0/3
A and B
A= $distributionB= $file
ABresult
0X0
100
111
22 if !$distribution || !$file;
23  
24 0 my $content = eval {
25 0 my $dist_dir = dist_dir($distribution);
26  
27 0 my ($path) = grep { -e "$dist_dir/$_" } ( $file, "share/$file" );
28  
29 0 ▶ die "$file not found in $distribution\n"
Branch: 1 branch
BranchTrueFalseTotal
unless $path 0 0 0
30 if !$path;
31  
32 0 return slurp $path;
33 };
34  
35 0 ▶ die "ERROR: could not fetch $file from $distribution\n$EVAL_ERROR"
Branch: 1 branch
BranchTrueFalseTotal
if not $content or $CPAN::Maker::Bootstrapper::Role::DistFile::EVAL_ERROR 0 0 0
Condition0%0/3
not $content or $CPAN::Maker::Bootstrapper::Role::DistFile::EVAL_ERROR
l!l&&r!l&&!r
000
MC/DC0%0/2
not $content or $CPAN::Maker::Bootstrapper::Role::DistFile::EVAL_ERROR
not $content $CPAN::Maker::Bootstrapper::Role::DistFile::EVAL_ERROR
Truth table0%0/3
not(A) or B
A= not $contentB= $CPAN::Maker::Bootstrapper::Role::DistFile::EVAL_ERROR
ABresult
1X1
011
000
36 if !$content || $EVAL_ERROR;
37  
38 0 print {*STDOUT} $content;
39  
40 0 return $SUCCESS;
41 }
42  
43 2 1;
« CPAN/Maker/Bootstrapper/Role/ShowDefaults.pm ↑ Summary CPAN/Maker/Bootstrapper/Role/ScaffoldImporter.pm »