lib/CPAN/Maker/Role/ModuleUtils.pm

filter: Statementstmt 37.9% 11 / 29 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 31.1% 14 / 45 CC 6 SCAR 32.5
CC
6
Cov
30%
get_module_version
42.0
make_path_from_module
2.0
BEGIN
1.0
CRAP 25.7
« lib/CPAN/Maker/Role/FileUtils.pm ↑ Summary lib/CPAN/Maker/Utils.pm »
1 package CPAN::Maker::Role::ModuleUtils;
2  
3 1 ▶use CLI::Simple::Constants qw(:chars);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use ExtUtils::MM;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '2.0.13';
9  
10 ########################################################################
11 0 ▶sub make_path_from_module {
Subroutine make_path_from_module: not called CC=1 SCAR=6.9
Pod undocumented
12 ########################################################################
13 0 my ( $self, $module ) = @_;
14  
15 0 my $file = join $SLASH, split /$DOUBLE_COLON/xsm, $module;
16  
17 0 return "$file.pm";
18 }
19  
20 ########################################################################
21 0 ▶sub get_module_version {
Subroutine get_module_version: not called CC=6 SCAR=37.4
Pod undocumented
22 ########################################################################
23 0 my ( $self, $module_w_version, @include_path ) = @_;
24  
25 0 ▶ if ( !@include_path ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@include_path) 0 0 0
26 0 @include_path = $DOT;
27 }
28  
29 0 my ( $module, $version ) = split /\s+/xsm, $module_w_version;
30  
31 0 my %module_version = (
32 module => $module,
33 version => $version,
34 path => undef,
35 );
36  
37 0 ▶ return \%module_version
Branch: 1 branch
BranchTrueFalseTotal
if $version 0 0 0
38 if $version;
39  
40 0 $module_version{file} = $self->make_path_from_module($module);
41  
42 0 foreach my $prefix (@include_path) {
43 0 my $path = $prefix . $SLASH . $module_version{file};
44  
45 0 ▶ next if !-e $path;
Branch: 1 branch
BranchTrueFalseTotal
unless -e $path 0 0 0
46  
47 0 my $version = eval { return ExtUtils::MM->parse_version($path); };
48 0 ▶ @module_version{qw(path version)} = ( $path, $version // 0 );
Condition0%0/2
$version // 0
l!l
00
MC/DC0%0/1
$version // 0
$version
Truth table0%0/2
A
A= $version
Aresult
11
00
49  
50 0 last;
51 }
52  
53 0 return \%module_version;
54 }
55  
56 1 1;
« lib/CPAN/Maker/Role/FileUtils.pm ↑ Summary lib/CPAN/Maker/Utils.pm »