blib/lib/File/Share.pm

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