builder/MyBuilder.pm

filter: Statementstmt 78.2% 36 / 46 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 2 totaltotal 77.1% 44 / 57 SCAR 7.1
CC
2
Cov
78%
new
2.0
process_xs_files
2.0
BEGIN
1.0
CRAP 2.0
« Build ↑ Summary blib/lib/Hash/FieldHash.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 warnings FATAL => qw(recursion);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use parent qw(Module::Build);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Devel::PPPort;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 my $xs_src = 'src';
11 1 my $xs_build = '_xs_build';
12  
13 sub new {
14 0 ▶ my($class, %args) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
15  
16 0 Devel::PPPort::WriteFile("$xs_src/ppport.h");
17  
18 0 my $so_prefix = $args{module_name};
19 0 $so_prefix =~ s/::\w+$//;
20 0 $so_prefix =~ s{::}{/}g;
21  
22 #$args{c_source} = $xs_src;
23 0 $args{needs_compiler} = 1;
24 $args{xs_files} = {
25 0 map { $_ => "./$xs_build/" . $_ }
26 glob("$xs_src/*.xs"),
27 };
28  
29 0 $args{extra_compiler_flags} = ["-I$xs_src"];
30  
31 0 return $class->SUPER::new(%args);
32 }
33  
34 sub process_xs_files {
35 1 ▶ my($self) = @_;
Subroutine process_xs_files: called CC=2 SCAR=6.9
Pod undocumented
36  
37 # NOTE:
38 # XS modules are consist of not only *.xs, but also *.c, *.xsi, and etc.
39 1 foreach my $from(glob "$xs_src/*.{c,cpp,cxx,xsi,xsh}") {
40 1 my $to = "$xs_build/$from";
41 1 $self->add_to_cleanup($to);
42 1 $self->copy_if_modified(from => $from, to => $to);
43 }
44  
45 1 $self->SUPER::process_xs_files();
46 }
47  
48 sub _infer_xs_spec {
49 1 ▶ my($self, $xs_file) = @_;
Subroutine _infer_xs_spec: called CC=1 SCAR=0.0
50  
51 1 my $spec = $self->SUPER::_infer_xs_spec($xs_file);
52  
53 1 $spec->{module_name} = $self->module_name;
54  
55 1 my @d = split /::/, $spec->{module_name};
56  
57 1 my $basename = pop @d;
58  
59 # NOTE:
60 # They've been infered from the XS filename, but it's a bad idea!
61 # That's because these names are used by XSLoader, which
62 # deduces filenames from the module name, not an XS filename.
63  
64 1 $spec->{archdir} = File::Spec->catfile(
65 $self->blib, 'arch', 'auto',
66 @d, $basename);
67  
68 $spec->{bs_file} = File::Spec->catfile(
69 $spec->{archdir},
70 1 $basename . '.bs');
71  
72 $spec->{lib_file} = File::Spec->catfile(
73 $spec->{archdir},
74 1 $basename . '.' . $self->{config}->get('dlext'));
75  
76 #use Data::Dumper; print Dumper $spec;
77  
78 1 return $spec;
79 }
80  
81 1 1;
« Build ↑ Summary blib/lib/Hash/FieldHash.pm »