| 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
| |||||||||||||
| 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
| |||||||||||||
| 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
| |||||||||||||
| 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
MC/DC0%0/1
$version // 0
$version
Truth table0%0/2
A
A= $version
| |||||||||||||
| 49 | |||||||||||||
| 50 | 0 | last; | |||||||||||
| 51 | } | ||||||||||||
| 52 | |||||||||||||
| 53 | 0 | return \%module_version; | |||||||||||
| 54 | } | ||||||||||||
| 55 | |||||||||||||
| 56 | 1 | 1; | |||||||||||