lib/Module/Install/Bundle.pm

filter: Statementstmt 29.0% 16 / 55 Branchbran 0.0% 0 / 26 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 50.0% 5 / 10 Podpod 100% 4 / 4 totaltotal 25.5% 25 / 98 CC 17 SCAR 34.7
CC
17
Cov
19%
_install_bundled_dists
72.0
bundle_deps
30.0
auto_bundle_deps
20.0
CRAP 32.1
« lib/Module/Install/Can.pm ↑ Summary lib/Module/Install/Admin.pm »
1 package Module::Install::Bundle;
2  
3 46 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 46 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 46 ▶use Module::Install::Base ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 46 ▶use vars qw{$VERSION @ISA $ISCORE};
Subroutine BEGIN: called CC=1 SCAR=0.0
8 46 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
9 46 $VERSION = '1.21';
10 46 @ISA = 'Module::Install::Base';
11 46 $ISCORE = 1;
12 }
13  
14 0 ▶sub auto_bundle {
Subroutine auto_bundle: not called CC=2 SCAR=17.9
Pod documented
15 0 my $self = shift;
16  
17 0 ▶ return $self->_install_bundled_dists unless $self->is_admin;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_admin 0 0 0
18  
19 # Flatten array of arrays into a single array
20 0 my @core = map @$_, map @$_, grep ref, $self->requires;
21  
22 0 $self->bundle(@core);
23 }
24  
25 0 ▶sub bundle {
Subroutine bundle: not called CC=2 SCAR=17.9
Pod documented
26 0 my $self = shift;
27  
28 0 ▶ return $self->_install_bundled_dists unless $self->is_admin;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_admin 0 0 0
29  
30 0 $self->admin->bundle(@_);
31 }
32  
33 0 ▶sub auto_bundle_deps {
Subroutine auto_bundle_deps: not called CC=4 SCAR=30.0
Pod documented
34 0 my $self = shift;
35  
36 0 ▶ return $self->_install_bundled_dists unless $self->is_admin;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_admin 0 0 0
37  
38 # Flatten array of arrays into a single array
39 0 my @core = map @$_, map @$_, grep ref, $self->requires;
40 0 ▶ while (my ($name, $version) = splice(@core, 0, 2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@core, 0, 2)) 0 0 0
41 0 ▶ next unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
42 0 $self->bundle_deps($name, $version);
43 }
44 }
45  
46 0 ▶sub bundle_deps {
Subroutine bundle_deps: not called CC=5 SCAR=34.0
Pod documented
47 0 my ($self, $pkg, $version) = @_;
48  
49 0 ▶ return $self->_install_bundled_dists unless $self->is_admin;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_admin 0 0 0
50  
51 0 my $deps = $self->admin->scan_dependencies($pkg);
52 0 ▶ if (scalar keys %$deps == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %$deps == 0) 0 0 0
53 # Probably a user trying to install the package, read the dependencies from META.yml
54 0 %$deps = ( map { $$_[0] => undef } (@{$self->requires()}) );
55 }
56 0 foreach my $key (sort keys %$deps) {
57 0 ▶ $self->bundle($key, ($key eq $pkg) ? $version : 0);
Branch: 1 branch
BranchTrueFalseTotal
$key eq $pkg ? : 0 0 0
58 }
59 }
60  
61 0 ▶sub _install_bundled_dists {
Subroutine _install_bundled_dists: not called CC=8 SCAR=42.8
62 0 my $self = shift;
63  
64 # process bundle only the first time this function is called
65 0 ▶ return if $self->{bundle_processed};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"bundle_processed"} 0 0 0
66  
67 0 ▶ $self->makemaker_args->{DIR} ||= [];
Condition0%0/2
$self->makemaker_args->{"DIR"} ||= []
l!l
00
MC/DC0%0/1
$self->makemaker_args->{"DIR"} ||= []
$self->makemaker_args->{"DIR"}
Truth table0%0/2
A
A= $self->makemaker_args->{"DIR"}
Aresult
11
00
68  
69 # process all dists bundled in inc/BUNDLES/
70 0 my $bundle_dir = $self->_top->{bundle};
71 0 foreach my $sub_dir (glob File::Spec->catfile($bundle_dir,"*")) {
72  
73 0 ▶ next if -f $sub_dir;
Branch: 1 branch
BranchTrueFalseTotal
if -f $sub_dir 0 0 0
74  
75 # ignore dot dirs/files if any
76 0 my $dot_file = File::Spec->catfile($bundle_dir,'\.');
77 0 ▶ next if index($sub_dir, $dot_file) >= $[;
Branch: 1 branch
BranchTrueFalseTotal
if index($sub_dir, $dot_file) >= $[ 0 0 0
78  
79 # EU::MM can't handle Build.PL based distributions
80 0 ▶ if (-f File::Spec->catfile($sub_dir, 'Build.PL')) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f "File::Spec"->catfile($sub_dir, "Build.PL")) 0 0 0
81 0 warn "Skipped: $sub_dir has Build.PL.";
82 0 next;
83 }
84  
85 # EU::MM can't handle distributions without Makefile.PL
86 # (actually this is to cut blib in a wrong directory)
87 0 ▶ if (!-f File::Spec->catfile($sub_dir, 'Makefile.PL')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f "File::Spec"->catfile($sub_dir, "Makefile.PL")) 0 0 0
88 0 warn "Skipped: $sub_dir has no Makefile.PL.";
89 0 next;
90 }
91 0 push @{ $self->makemaker_args->{DIR} }, $sub_dir;
92 }
93  
94 0 $self->{bundle_processed} = 1;
95 }
96  
97 46 1;
98  
99 __END__
« lib/Module/Install/Can.pm ↑ Summary lib/Module/Install/Admin.pm »