blib/lib/Dist/Zilla/Plugin/Prereqs/From/cpmfile.pm

filter: Statementstmt 44.4% 12 / 27 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 33.3% 3 / 9 Podpod 0.0% 0 / 2 totaltotal 33.3% 15 / 45 CC 5 SCAR 16.7
CC
5
Cov
36%
metadata
12.0
__ANON__
6.0
__ANON__
6.0
CRAP 5.3
↑ Summary
1 package Dist::Zilla::Plugin::Prereqs::From::cpmfile v0.0.6;
2 1 ▶use v5.40;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Module::cpmfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 with 'Dist::Zilla::Role::PrereqSource', 'Dist::Zilla::Role::MetaProvider';
8  
9 1 has cpmfile => (
10 is => 'ro',
11 lazy => 1,
12 builder => '_build_cpmfile',
13 );
14  
15 has phases => (
16 is => 'ro',
17 lazy => 1,
18 0 ▶ default => sub (@) { [qw(configure build runtime test)] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
19 1 );
20  
21 0 ▶around BUILDARGS => sub ($orig, $class, @argv) {
Subroutine __ANON__: not called CC=2 SCAR=17.9
22 0 my %argv = $class->$orig(@argv)->%*;
23 0 ▶ if (exists $argv{phases}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $argv{"phases"}) 0 0 0
24 0 $argv{phases} = [ split /\s*,\s*/, $argv{phases} ];
25 }
26 0 \%argv;
27 1 };
28  
29 0 ▶sub _build_cpmfile ($self, @) {
Subroutine _build_cpmfile: not called CC=1 SCAR=6.9
30 0 $self->log("parsing cpm.yml to extract prereqs");
31 0 Module::cpmfile->load("cpm.yml");
32 }
33  
34 0 ▶sub register_prereqs ($self, @) {
Subroutine register_prereqs: not called CC=1 SCAR=6.9
Pod undocumented
35 0 ▶ $self->cpmfile->prereqs->walk($self->phases, undef, sub ($phase, $type, $package, $options, @) {
Subroutine __ANON__: not called CC=2 SCAR=17.9
36 $self->zilla->register_prereqs(
37 {phase => $phase, type => $type},
38 0 ▶ $package => $options->{version} || 0,
Condition0%0/2
$options->{'version'} || 0
l!l
00
MC/DC0%0/1
$options->{'version'} || 0
$options->{'version'}
Truth table0%0/2
A
A= $options->{'version'}
Aresult
11
00
39 );
40 0 });
41 }
42  
43 0 ▶sub metadata ($self, @) {
Subroutine metadata: not called CC=3 SCAR=24.8
Pod undocumented
44 0 my $features = $self->cpmfile->features;
45 0 ▶ return +{} if !$features;
Branch: 1 branch
BranchTrueFalseTotal
unless $features 0 0 0
46  
47 0 my $optional_features = {};
48 0 for my ($name, $feature) ($features->%*) {
49 $optional_features->{$name} = {
50 description => $feature->{description},
51 prereqs => $feature->{prereqs}->cpanmeta->as_string_hash,
52 0 };
53 }
54 0 return { optional_features => $optional_features };
55 }
56 __END__
↑ Summary