blib/lib/Module/Install/Any/Moose.pm

filter: Statementstmt 27.6% 13 / 47 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 4 / 6 Podpod 100% 1 / 1 totaltotal 24.3% 18 / 74 CC 10 SCAR 33.0
CC
10
Cov
20%
_any_moose_setup
42.0
requires_any_moose
30.0
BEGIN
1.0
CRAP 27.1
↑ Summary
1  
2 package Module::Install::Any::Moose;
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Module::Install::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use vars qw($VERSION @ISA $ISCORE);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 $VERSION = '0.00003';
9 1 $ISCORE = 0;
10 1 @ISA = qw(Module::Install::Base);
11 }
12  
13 0 ▶sub requires_any_moose {
Subroutine requires_any_moose: not called CC=5 SCAR=34.0
Pod documented
14 0 my $self = shift;
15 0 my ($module, %args);
16  
17 0 ▶ if (@_ % 2 == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ % 2 == 0) { } 0 0 0
18 0 %args = @_;
19 } else {
20 0 ($module, %args) = @_;
21 }
22  
23 0 ▶ my $prefer = ($args{prefer} ||= 'Mouse');
Condition0%0/2
$args{"prefer"} ||= "Mouse"
l!l
00
MC/DC0%0/1
$args{"prefer"} ||= "Mouse"
$args{"prefer"}
Truth table0%0/2
A
A= $args{"prefer"}
Aresult
11
00
24  
25 0 my $requires = $self->requires;
26 0 ▶ if (! grep { $_->[0] eq 'Any::Moose' } @$requires ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {$_->[0] eq "Any::Moose";} @$requires) 0 0 0
27 0 print "Adding Any::Moose to prerequisites...\n";
28 0 $self->requires('Any::Moose', 0.04);
29 }
30  
31 0 $self->_any_moose_setup($prefer, $module, %args);
32 0 ▶ $self->_any_moose_setup(
Branch: 1 branch
BranchTrueFalseTotal
$prefer eq 'Mouse' ? : 0 0 0
33 ($prefer eq 'Mouse' ? 'Moose' : 'Mouse'), $module, %args );
34 }
35  
36 0 ▶sub _any_moose_setup {
Subroutine _any_moose_setup: not called CC=6 SCAR=37.4
37 0 my ($self, $prefix, $frag, %args) = @_;
38  
39 0 ▶ my $module = $frag ? $prefix . $frag : $prefix;
Branch: 1 branch
BranchTrueFalseTotal
$frag ? : 0 0 0
40  
41 0 my $prefer = $args{ prefer };
42 0 my $version = $args{ lc $prefix };
43 0 ▶ if ($prefer eq $prefix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prefer eq $prefix) { } 0 0 0
44 0 $self->requires($module, $version);
45 } else {
46 0 print "[Any::Moose support for $module]\n",
47 "- $module ... ";
48  
49 # ripped out of ExtUtils::MakeMaker
50 0 my $file = "$module.pm";
51 0 $file =~ s{::}{/}g;
52 0 eval { require $file };
53  
54 0 ▶ my $pr_version = $module->VERSION || 0;
Condition0%0/2
$module->VERSION || 0
l!l
00
MC/DC0%0/1
$module->VERSION || 0
$module->VERSION
Truth table0%0/2
A
A= $module->VERSION
Aresult
11
00
55 0 $pr_version =~ s/(\d+)\.(\d+)_(\d+)/$1.$2$3/;
56  
57 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
58 0 print "missing\n";
59 0 my $y_n = ExtUtils::MakeMaker::prompt(" Add $module to the prerequisites?", 'n');
60 0 ▶ if ($y_n =~ /^y(?:es)?$/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($y_n =~ /^y(?:es)?$/i) { } 0 0 0
61 0 $self->requires($module, $version);
62 } else {
63 0 $self->recommends($module, $version);
64 }
65 } else {
66 0 print "loaded ($pr_version)\n";
67 0 $self->recommends($module, $version);
68 }
69 }
70 }
71  
72 1 1;
73  
74 __END__
↑ Summary