blib/lib/ylib.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 35 / 35 CC 5 SCAR 11.7
CC
5
Cov
100%
import
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
↑ Summary
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package ylib;
5 # ABSTRACT: Add paths to @INC from a config file
6 1 our $VERSION = '0.003'; # VERSION
7  
8 1 ▶use File::HomeDir 0.86 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Path::Tiny 0.052;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 require lib;
12  
13 1 my $name = '.mylib';
14  
15 6 ▶sub import {
Subroutine import: called CC=5 SCAR=16.1
16 6 my $class = shift;
17 6 my @configs = map { path( $_, $name ) } ( File::HomeDir->my_home(), '.' );
18 6 for my $f (@configs) {
19 12 ▶ next unless -r $f;
Branch: 1 branch
BranchTrueFalseTotal
unless -r $f 5 7 12
20 7 for my $dir ( $f->lines( { chomp => 1 } ) ) {
21 10 ▶ if ( -d $dir ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $dir) { } 9 1 10
22 9 lib->import("$dir");
23 }
24 else {
25 1 warn "lib '$dir' was not found. skipping it\n";
26 }
27 }
28 }
29 6 return 1;
30 }
31  
32 1 1;
33  
34 __END__
↑ Summary