builder/MyBuilder.pm

filter: Statementstmt 64.8% 35 / 54 Branchbran 41.6% 5 / 12 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 54.5% 6 / 11 Podpod 0.0% 0 / 3 totaltotal 55.2% 47 / 85 CC 9 SCAR 16.0
CC
9
Cov
59%
ACTION_code
10.5
_derive_opcode
6.0
_write_xs_version
2.0
CRAP 4.9
« blib/lib/Text/Xslate/Bridge.pm ↑ Summary blib/lib/Text/Xslate/PP/State.pm »
1 package builder::MyBuilder;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base 'Module::Build::XSUtil';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
7 0 my ($class, %args) = @_;
8  
9 0 my $self = $class->SUPER::new(
10 %args,
11 c_source => ['src'],
12 cc_warnings => 1,
13 generate_ppport_h => 'src/ppport.h',
14 generate_xshelper_h => 'src/xshelper.h',
15 xs_files => { 'src/Text-Xslate.xs' => 'lib/Text/Xslate.xs' },
16 );
17  
18 # src/xslate_ops.h uses special operators name in C++,
19 # such as "and", "or", "not";
20 # so remove "-Wc++-compat" flags
21 0 my $flags = $self->extra_compiler_flags;
22 0 $self->extra_compiler_flags(grep { $_ ne "-Wc++-compat" } @$flags);
23 0 $self;
24 }
25  
26 1 ▶sub _write_xs_version {
Subroutine _write_xs_version: called CC=2 SCAR=7.0
27 1 my ($self, $file) = @_;
28 1 ▶ open my $fh, ">", $file or die "$file: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $file or die "${file}: $!" 1 0 1
29 1 print {$fh} "#ifndef XS_VERSION\n";
30 1 printf {$fh} "# define XS_VERSION \"%s\"\n", $self->dist_version;
31 1 print {$fh} "#endif\n";
32 }
33  
34 0 ▶sub _derive_opcode {
Subroutine _derive_opcode: not called CC=2 SCAR=17.9
35 0 my ($self, $script, $source, $derived) = @_;
36 0 my @cmd = ($self->{properties}{perl}, $script, $source);
37 0 $self->log_info("@cmd > $derived\n");
38 0 ▶ open my $fh, ">", $derived or die "$derived: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $derived or die "${derived}: $!" 0 0 0
39 0 print {$fh} $self->_backticks(@cmd);
40 }
41  
42 1 ▶sub ACTION_code {
Subroutine ACTION_code: called CC=6 SCAR=23.5
Pod undocumented
43 1 my ($self, @args) = @_;
44  
45 1 ▶ if (!$self->pureperl_only) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->pureperl_only) 1 0 1
46 1 $self->_write_xs_version("src/xs_version.h");
47 }
48  
49 my @derive = (
50 {
51 xs => 0,
52 source => "src/xslate_opcode.inc",
53 derived => "lib/Text/Xslate/PP/Const.pm",
54 0 ▶ code => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
55 0 my ($self, $source, $derived) = @_;
56 0 $self->_derive_opcode("tool/opcode_for_pp.PL", $source, $derived);
57 },
58 },
59 {
60 xs => 1,
61 source => "src/xslate_opcode.inc",
62 derived => "src/xslate_ops.h",
63 0 ▶ code => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
64 0 my ($self, $source, $derived) = @_;
65 0 $self->_derive_opcode("tool/opcode.PL", $source, $derived);
66 },
67 },
68 {
69 xs => 1,
70 source => "src/xslate_methods.xs",
71 derived => "src/xslate_methods.c",
72 0 ▶ code => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
73 0 my ($self, $source, $derived) = @_;
74 0 $self->compile_xs($source, outfile => $derived);
75 },
76 }
77  
78 1 );
79 1 for my $derive (@derive) {
80 3 ▶ next if $self->pureperl_only and $derive->{xs};
Branch: 1 branch
BranchTrueFalseTotal
if $self->pureperl_only and $derive->{"xs"} 0 3 3
Condition33%1/3
$self->pureperl_only and $derive->{"xs"}
!ll&&!rl&&r
300
MC/DC0%0/2
$self->pureperl_only and $derive->{"xs"}
$self->pureperl_only $derive->{"xs"}
Truth table33%1/3
A and B
A= $self->pureperl_onlyB= $derive->{"xs"}
ABresult
0X0
100
111
81 3 ▶ next if $self->up_to_date($derive->{source}, $derive->{derived});
Branch: 1 branch
BranchTrueFalseTotal
if $self->up_to_date($derive->{"source"}, $derive->{"derived"}) 3 0 3
82 0 $derive->{code}->($self, $derive->{source}, $derive->{derived});
83 }
84  
85 1 $self->SUPER::ACTION_code(@args);
86 }
87  
88 1 ▶sub ACTION_test {
Subroutine ACTION_test: called CC=2 SCAR=6.9
Pod undocumented
89 1 my ($self, @args) = @_;
90  
91 1 ▶ if (!$self->pureperl_only) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->pureperl_only) 1 0 1
92 1 local $ENV{XSLATE} = 'xs';
93 1 $self->log_info("xs tests\n");
94 1 $self->SUPER::ACTION_test(@args);
95 }
96  
97 {
98 1 local $ENV{PERL_ONLY} = 1;
99 1 $self->log_info("pureperl tests\n");
100 1 $self->SUPER::ACTION_test(@args);
101 }
102 }
103  
104 1 1;
« blib/lib/Text/Xslate/Bridge.pm ↑ Summary blib/lib/Text/Xslate/PP/State.pm »