lib/FFI/Platypus/ShareConfig.pm

filter: Statementstmt 91.1% 31 / 34 Branchbran 56.2% 9 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 79.3% 46 / 58 CC 10 SCAR 18.7
CC
10
Cov
80%
get
11.0
dist_dir
4.0
BEGIN
1.0
CRAP 6.5
« lib/FFI/Probe.pm ↑ Summary blib/lib/FFI/Platypus/Lang/Win32.pm »
1 package FFI::Platypus::ShareConfig;
2  
3 63 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 63 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 63 ▶use 5.008004;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 63 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 63 our $VERSION = '2.12'; # VERSION
9  
10 sub dist_dir ($)
11 601 ▶{
Subroutine dist_dir: called CC=4 SCAR=13.9
Pod undocumented
12 601 my($dist_name) = @_;
13  
14 601 my @pm = split /-/, $dist_name;
15 601 $pm[-1] .= ".pm";
16  
17 601 foreach my $inc (@INC)
18 {
19 1208 ▶ if(-f File::Spec->catfile($inc, @pm))
Branch: 1 branch
BranchTrueFalseTotal
if (-f "File::Spec"->catfile($inc, @pm)) 601 607 1208
20 {
21 601 my $share = File::Spec->catdir($inc, qw( auto share dist ), $dist_name );
22 601 ▶ if(-d $share)
Branch: 1 branch
BranchTrueFalseTotal
if (-d $share) 565 36 601
23 {
24 565 return File::Spec->rel2abs($share);
25 }
26 36 last;
27 }
28 }
29 36 Carp::croak("unable to find dist share directory for $dist_name");
30 }
31  
32 sub get
33 524 ▶{
Subroutine get: called CC=7 SCAR=24.0
Pod undocumented
34 524 my(undef, $name) = @_;
35 524 my $config;
36  
37 524 ▶ unless($config)
Branch: 1 branch
BranchTrueFalseTotal
unless ($config) 524 0 524
38 {
39 524 my $fn = File::Spec->catfile(dist_dir('FFI-Platypus'), 'config.pl');
40 524 ▶ $fn = File::Spec->rel2abs($fn) unless File::Spec->file_name_is_absolute($fn);
Branch: 1 branch
BranchTrueFalseTotal
unless "File::Spec"->file_name_is_absolute($fn) 0 524 524
41 524 local $@;
42 524 ▶ unless($config = do $fn)
Branch: 1 branch
BranchTrueFalseTotal
unless ($config = do $fn) 0 524 524
43 {
44 0 ▶ die "couldn't parse configuration $fn $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
45 0 ▶ die "couldn't do $fn $!" if $!;
Branch: 1 branch
BranchTrueFalseTotal
if $! 0 0 0
46 0 die "bad or missing config file $fn";
47 };
48 }
49  
50 524 ▶ defined $name ? $config->{$name} : $config;
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 522 2 524
51 }
52  
53 63 1;
54  
55 __END__
« lib/FFI/Probe.pm ↑ Summary blib/lib/FFI/Platypus/Lang/Win32.pm »