blib/lib/File/Share.pm

filter: Statementstmt 57.8% 22 / 38 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 60.0% 6 / 10 Podpod 0.0% 0 / 4 totaltotal 36.3% 28 / 77 SCAR 31.1
CC
8
Cov
39%
dist_dir
72.0
dist_file
2.0
module_dir
2.0
CRAP 22.3
↑ Summary
1 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package File::Share;
3 1 our $VERSION = '0.26';
4  
5 1 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 our @EXPORT_OK = qw[
7 dist_dir
8 dist_file
9 module_dir
10 module_file
11 class_dir
12 class_file
13 ];
14 1 our %EXPORT_TAGS = (
15 all => [ @EXPORT_OK ],
16 ALL => [ @EXPORT_OK ],
17 );
18  
19 1 ▶use File::ShareDir();
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use Cwd qw(abs_path);
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use File::Spec();
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 sub dist_dir {
24 0 ▶ my ($dist) = @_;
Subroutine dist_dir: not called CC=8 SCAR=42.8
Pod undocumented
25 0 (my $inc = $dist) =~ s!(-|::)!/!g;
26 0 $inc .= '.pm';
27  
28 0 ▶ my $path = $INC{$inc} || '';
Condition0%0/2
$INC{$inc} || ''
l!l
00
MC/DC0%0/1
$INC{$inc} || ''
$INC{$inc}
Truth table0%0/2
A
A= $INC{$inc}
Aresult
11
00
29 0 $path =~ s/$inc$//;
30 0 $path = Cwd::realpath( File::Spec->catfile($path, '..') );
31  
32 0 ▶ if ($path =~ m<^(.*?)[\/\\]blib\b> and
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m(^(.*?)[\/\\]blib\b) and -d "File::Spec"->catdir($1, "share") and -d ($_ = "File::Spec"->catdir($1, "share"))) 0 0 0
Condition0%0/6
$path =~ m(^(.*?)[\/\\]blib\b) and -d "File::Spec"->catdir($1, "share") and -d ($_ = "File::Spec"->catdir($1, "share"))
!ll&&!rl&&r
000
$path =~ m(^(.*?)[\/\\]blib\b) and -d "File::Spec"->catdir($1, "share")
!ll&&!rl&&r
000
MC/DC0%0/3
$path =~ m(^(.*?)[\/\\]blib\b) and -d "File::Spec"->catdir($1, "share") and -d ($_ = "File::Spec"->catdir($1, "share"))
$path =~ m(^(.*?)[\/\\]blib\b) -d "File::Spec"->catdir($1, "share") -d ($_ = "File::Spec"->catdir($1, "share"))
Truth table0%0/4
A and B and C
A= $path =~ m(^(.*?)[\/\\]blib\b)B= -d "File::Spec"->catdir($1, "share")C= -d ($_ = "File::Spec"->catdir($1, "share"))
ABCresult
0XX0
10X0
1100
1111
33 -d File::Spec->catdir($1, 'share') and
34 -d ($_ = File::Spec->catdir($1, 'share'))
35 ) {
36 0 return abs_path($_);
37 }
38  
39 0 ▶ if ($path and
Branch: 1 branch
BranchTrueFalseTotal
if ($path and -d "File::Spec"->catdir($path, "lib") and -d ($_ = "File::Spec"->catdir($path, "share"))) 0 0 0
Condition0%0/6
$path and -d "File::Spec"->catdir($path, "lib") and -d ($_ = "File::Spec"->catdir($path, "share"))
!ll&&!rl&&r
000
$path and -d "File::Spec"->catdir($path, "lib")
!ll&&!rl&&r
000
MC/DC0%0/3
$path and -d "File::Spec"->catdir($path, "lib") and -d ($_ = "File::Spec"->catdir($path, "share"))
$path -d "File::Spec"->catdir($path, "lib") -d ($_ = "File::Spec"->catdir($path, "share"))
Truth table0%0/4
A and B and C
A= $pathB= -d "File::Spec"->catdir($path, "lib")C= -d ($_ = "File::Spec"->catdir($path, "share"))
ABCresult
0XX0
10X0
1100
1111
40 -d File::Spec->catdir($path, 'lib') and
41 -d ($_ = File::Spec->catdir($path, 'share'))
42 ) {
43 0 return abs_path($_);
44 }
45  
46 0 return File::ShareDir::dist_dir($dist);
47 }
48  
49 sub dist_file {
50 0 ▶ my ($dist, $file) = @_;
Subroutine dist_file: not called CC=1 SCAR=6.9
Pod undocumented
51 0 my $dir = dist_dir($dist);
52 0 return File::Spec->catfile( $dir, $file );
53 }
54  
55 sub module_dir {
56 0 ▶ die "File::Share::module_dir not yet supported";
Subroutine module_dir: not called CC=1 SCAR=6.9
Pod undocumented
57 }
58  
59 sub module_file {
60 0 ▶ die "File::Share::module_file not yet supported";
Subroutine module_file: not called CC=1 SCAR=6.9
Pod undocumented
61 }
62  
63 1 1;
↑ Summary