ArgumentCollector.pm

filter: Statementstmt 100% 32 / 32 Branchbran 75.0% 3 / 4 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 5 totaltotal 82.1% 46 / 56 CC 5 SCAR 5.8
CC
5
Cov
92%
fix_ranking
3.0
new_argument
2.1
_init
2.0
CRAP 1.8
« Binary.pm ↑ Summary Compiler.pm »
1 package ExtUtils::Builder::ArgumentCollector;
2 4 $ExtUtils::Builder::ArgumentCollector::VERSION = '0.038';
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 15 ▶sub _init {
Subroutine _init: called CC=2 SCAR=7.1
7 15 my ($self, %args) = @_;
8 15 ▶ $self->{arguments} = $args{arguments} // [];
Condition50%1/2
$args{"arguments"} // []
l!l
015
MC/DC0%0/1
$args{"arguments"} // []
$args{"arguments"}
Truth table50%1/2
A
A= $args{"arguments"}
Aresult
11
00
9 15 return;
10 }
11  
12 3 ▶sub add_argument {
Subroutine add_argument: called CC=1 SCAR=0.0
Pod undocumented
13 3 my ($self, %arguments) = @_;
14 3 $arguments{ranking} = $self->fix_ranking(delete @arguments{qw/ranking fix/});
15 3 push @{ $self->{arguments} }, $self->new_argument(%arguments);
16 3 return;
17 }
18  
19 31 ▶sub new_argument {
Subroutine new_argument: called CC=2 SCAR=7.2
Pod undocumented
20 31 my ($self, %args) = @_;
21 31 ▶ return [ $args{ranking} // 50, $args{value} ];
Condition50%1/2
$args{"ranking"} // 50
l!l
310
MC/DC0%0/1
$args{"ranking"} // 50
$args{"ranking"}
Truth table50%1/2
A
A= $args{"ranking"}
Aresult
11
00
22 }
23  
24 15 ▶sub collect_arguments {
Subroutine collect_arguments: called CC=1 SCAR=0.0
Pod undocumented
25 15 my $self = shift;
26 15 return @{ $self->{arguments} };
27 }
28  
29 15 ▶sub arguments {
Subroutine arguments: called CC=1 SCAR=0.0
Pod undocumented
30 15 my ($self, @args) = @_;
31 4 ▶ use sort 'stable';
Subroutine BEGIN: called CC=1 SCAR=0.0
32 15 return map { @{ $_->[1] } } sort { $a->[0] <=> $b->[0] } $self->collect_arguments(@args);
33 }
34  
35 10 ▶sub fix_ranking {
Subroutine fix_ranking: called CC=3 SCAR=11.1
Pod undocumented
36 10 my (undef, $baseline, $override) = @_;
37 10 ▶ return $baseline if not defined $override;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $override 9 1 10
38 1 ▶ return (ref($override) eq 'CODE') ? $override->($baseline) : $override;
Branch: 1 branch
BranchTrueFalseTotal
ref $override eq 'CODE' ? : 1 0 1
39 }
40  
41 4 1;
42  
43 =pod
44  
45 =encoding UTF-8
46  
47 =head1 NAME
48  
49 ExtUtils::Builder::ArgumentCollector - Helper role for argument collecting classes
50  
51 =head1 VERSION
52  
53 version 0.038
54  
55 =head1 DESCRIPTION
56  
57 This is a helper role for classes that collect arguments for their command. Classes that use this include ExtUtils::Builder::Compiler and ExtUtils::Builder::Linker
58  
59 =head1 AUTHOR
60  
61 Leon Timmermans <fawaka@gmail.com>
62  
63 =head1 COPYRIGHT AND LICENSE
64  
65 This software is copyright (c) 2012 by Leon Timmermans.
66  
67 This is free software; you can redistribute it and/or modify it under
68 the same terms as the Perl 5 programming language system itself.
69  
70 =cut
71  
72 __END__
« Binary.pm ↑ Summary Compiler.pm »