blib/lib/lib/absolute.pm

filter: Statementstmt 95.6% 22 / 23 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 91.4% 32 / 35 CC 5 SCAR 12.7
CC
5
Cov
90%
import
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.6
↑ Summary
1 package lib::absolute;
2 3 our $AUTHORITY = 'cpan:GETTY';
3 # ABSTRACT: Convert all paths in @INC to absolute paths
4 3 $lib::absolute::VERSION = '0.100';
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶sub import {
Subroutine import: called CC=5 SCAR=16.3
10 3 my ( $self, @args ) = @_;
11 3 my $hard = grep { $_ eq '-hard' } @args;
12 @INC = map {
13 3 ▶ if (ref $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_) { } 0 19 19
14 0 $_;
15 } else {
16 19 my $dir = path($_)->absolute;
17 19 ▶ if ($hard) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hard) 1 18 19
18 1 ▶ die $dir.' of @INC doesn\'t exist' unless -d $dir;
Branch: 1 branch
BranchTrueFalseTotal
unless -d $dir 1 0 1
19 }
20 18 ▶ $dir->stringify, $_ eq '.' ? '.' : ();
Branch: 1 branch
BranchTrueFalseTotal
$_ eq '.' ? : 3 15 18
21 }
22 } @INC;
23 2 return;
24 }
25  
26 3 1;
27  
28 __END__
↑ Summary