Compiler.pm

filter: Statementstmt 95.3% 61 / 64 Branchbran 66.6% 4 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 93.7% 15 / 16 Podpod 30.0% 3 / 10 totaltotal 84.8% 84 / 99 CC 5 SCAR 4.4
CC
5
Cov
92%
compile
3.0
add_profile
2.0
new
2.0
CRAP 1.6
« ArgumentCollector.pm ↑ Summary Linker/Unixy.pm »
1 package ExtUtils::Builder::Compiler;
2 3 $ExtUtils::Builder::Compiler::VERSION = '0.038';
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use ExtUtils::Builder::Util qw/command require_module/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use ExtUtils::Builder::Node;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶use parent qw/ExtUtils::Builder::ArgumentCollector ExtUtils::Builder::Binary/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 10 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod undocumented
12 10 my ($class, %args) = @_;
13 10 my $cc = $args{cc};
14 10 ▶ $cc = [ $cc ] if not ref $cc;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $cc 3 7 10
15 my $self = bless {
16 cc => $cc,
17 include_dirs => [],
18 defines => [],
19 standard => $args{standard},
20 10 }, $class;
21 10 $self->_init(%args);
22 10 return $self;
23 }
24  
25 10 ▶sub _init {
Subroutine _init: called CC=1 SCAR=0.0
26 10 my ($self, %args) = @_;
27 10 $self->ExtUtils::Builder::ArgumentCollector::_init(%args);
28 10 $self->ExtUtils::Builder::Binary::_init(%args);
29 10 return;
30 }
31  
32 sub compile_flags;
33  
34 10 ▶sub cc {
Subroutine cc: called CC=1 SCAR=0.0
Pod undocumented
35 10 my $self = shift;
36 10 return @{ $self->{cc} };
37 }
38  
39 3 ▶sub add_include_dirs {
Subroutine add_include_dirs: called CC=1 SCAR=0.0
Pod documented
40 3 my ($self, $dirs, %opts) = @_;
41 3 my $ranking = $self->fix_ranking($self->default_include_ranking, $opts{ranking});
42 3 push @{ $self->{include_dirs} }, map { { ranking => $ranking, value => $_ } } @{ $dirs };
43 3 return;
44 }
45  
46 3 ▶sub default_include_ranking {
Subroutine default_include_ranking: called CC=1 SCAR=0.0
Pod undocumented
47 3 return 30;
48 }
49  
50 4 ▶sub add_defines {
Subroutine add_defines: called CC=1 SCAR=0.0
Pod documented
51 4 my ($self, $defines, %opts) = @_;
52 4 my $ranking = $self->fix_ranking($self->default_define_ranking, $opts{ranking});
53 4 push @{ $self->{defines} }, map { { key => $_, ranking => $ranking, value => $defines->{$_} } } keys %{ $defines };
54 4 return;
55 }
56  
57 1 ▶sub add_profile {
Subroutine add_profile: called CC=2 SCAR=7.0
Pod undocumented
58 1 my ($self, $profile, %args) = @_;
59 1 ▶ if (not ref($profile)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $profile) 1 0 1
60 1 $profile =~ s/ \A @ /ExtUtils::Builder::Profile::/xms;
61 1 require_module($profile);
62 }
63 1 return $profile->process_compiler($self, \%args);
64 }
65  
66 4 ▶sub default_define_ranking {
Subroutine default_define_ranking: called CC=1 SCAR=0.0
Pod undocumented
67 4 return 40;
68 }
69  
70 0 ▶sub set_standard {
Subroutine set_standard: not called CC=1 SCAR=6.9
Pod undocumented
71 0 my ($self, $version) = @_;
72 0 $self->{standard} = $version;
73 0 return;
74 }
75  
76 10 ▶sub collect_arguments {
Subroutine collect_arguments: called CC=1 SCAR=0.0
Pod undocumented
77 10 my ($self, @args) = @_;
78 10 return ($self->SUPER::collect_arguments, $self->compile_flags(@args));
79 }
80  
81 10 ▶sub compile {
Subroutine compile: called CC=3 SCAR=11.1
Pod documented
82 10 my ($self, $from, $to, %opts) = @_;
83 10 my @actions ;
84 10 ▶ push @actions, $self->_mkdir_for($to) if $opts{mkdir};
Branch: 1 branch
BranchTrueFalseTotal
if $opts{"mkdir"} 0 10 10
85 10 my @argv = $self->arguments($from, $to, %opts);
86 10 push @actions, command($self->cc, @argv);
87 10 ▶ my $deps = [ $from, @{ $opts{dependencies} // [] } ];
Condition50%1/2
$opts{"dependencies"} // []
l!l
010
MC/DC0%0/1
$opts{"dependencies"} // []
$opts{"dependencies"}
Truth table50%1/2
A
A= $opts{"dependencies"}
Aresult
11
00
88 10 return ExtUtils::Builder::Node->new(target => $to, dependencies => $deps, actions => \@actions);
89 }
90  
91 3 1;
92  
93 # ABSTRACT: An interface around different compilers.
94  
95 __END__
« ArgumentCollector.pm ↑ Summary Linker/Unixy.pm »