lib/Dist/Build/Serializer.pm

filter: Statementstmt 34.4% 20 / 58 Branchbran 0.0% 0 / 36 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 6 / 10 Podpod 66.6% 2 / 3 totaltotal 26.1% 28 / 107 CC 19 SCAR 47.4
CC
19
Cov
21%
deserialize_action
210.0
serialize_action
42.0
__ANON__
2.0
CRAP 114.4
« blib/lib/Dist/Build/XS.pm ↑ Summary blib/lib/Dist/Build/XS/Alien.pm »
1 package Dist::Build::Serializer;
2 1 $Dist::Build::Serializer::VERSION = '0.028';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use parent 'ExtUtils::Builder::Serializer';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use List::Util 1.33 'any';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use ExtUtils::Builder::Action::Function;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Dist::Build::Core;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 0 ▶sub serialize_action {
Subroutine serialize_action: not called CC=6 SCAR=37.4
Pod documented
14 0 my ($self, $action, %args) = @_;
15  
16 0 ▶ if ($action->isa('ExtUtils::Builder::Action::Function')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($action->isa("ExtUtils::Builder::Action::Function")) 0 0 0
17 0 ▶ if ($action->module eq 'Dist::Build::Core') {
Branch: 2 branches
BranchTrueFalseTotal
if ($action->module eq 'Dist::Build::Core') { } 0 0 0
elsif ($action->module eq 'File::Path') { } 0 0 0
18 0 return [ $action->function, $action->arguments ];
19 } elsif ($action->module eq 'File::Path') {
20 0 ▶ if ($action->function eq 'make_path') {
Branch: 2 branches
BranchTrueFalseTotal
if ($action->function eq 'make_path') { } 0 0 0
elsif ($action->function eq 'remove_tree') { } 0 0 0
21 0 return [ 'mkdir', $action->arguments ];
22 } elsif ($action->function eq 'remove_tree') {
23 0 return [ 'rm_r', $action->arguments ];
24 }
25 }
26 }
27  
28 0 return $self->SUPER::serialize_action($action);
29 }
30  
31 0 ▶sub deserialize_action {
Subroutine deserialize_action: not called CC=14 SCAR=53.5
Pod documented
32 0 my ($self, $serialized, %options) = @_;
33 0 my ($command, @args) = @{$serialized};
34  
35 0 my $message = join ' ', @{$serialized};
36 0 ▶ if ($command eq 'tap_harness') {
Branch: 6 branches
BranchTrueFalseTotal
if ($command eq 'tap_harness') { } 0 0 0
elsif ($command eq 'copy') { } 0 0 0
elsif ($command eq 'mkdir') { } 0 0 0
elsif ($command eq 'rm_r') { } 0 0 0
elsif ($command eq 'install') { } 0 0 0
elsif (&any(sub { $command eq $_; } , @Dist::Build::Core::EXPORT_OK)) { } 0 0 0
37 0 my %args = @args;
38 0 ▶ $args{verbose} = $options{verbose} if defined $options{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"verbose"} 0 0 0
39 0 ▶ $args{jobs} = $options{jobs} if defined $options{jobs};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"jobs"} 0 0 0
40 0 return make_function('tap_harness', 'prove', %args);
41 } elsif ($command eq 'copy') {
42 0 my ($source, $destination, %args) = @args;
43 0 ▶ $args{verbose} = $options{verbose} if defined $options{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"verbose"} 0 0 0
44 0 $message = sprintf("cp %s %s", $source, $destination);
45 0 return make_function('copy', "cp $source $destination", $source, $destination, %args);
46 } elsif ($command eq 'mkdir') {
47 0 my ($destination, %args) = @args;
48 0 ▶ $args{verbose} = $options{verbose} if defined $options{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"verbose"} 0 0 0
49 0 return ExtUtils::Builder::Action::Function->new(
50 function => 'make_path',
51 module => 'File::Path',
52 arguments => [ $destination, %args ],
53 exports => 'explicit',
54 message => "mkdir $destination",
55 );
56 } elsif ($command eq 'rm_r') {
57 0 my (@files) = @args;
58 0 return ExtUtils::Builder::Action::Function->new(
59 function => 'remove_tree',
60 module => 'File::Path',
61 arguments => \@files,
62 exports => 'explicit',
63 message => "rm_r @files",
64 );
65 } elsif ($command eq 'install') {
66 0 my %args = @args;
67 0 ▶ $args{verbose} = $options{verbose} if defined $options{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"verbose"} 0 0 0
68 0 ▶ $args{uninst} = $options{uninst} if defined $options{uninst};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"uninst"} 0 0 0
69 0 ▶ $args{dry_run} = $options{dry_run} if defined $options{dry_run};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"dry_run"} 0 0 0
70 0 $args{install_map} = $options{install_paths}->install_map;
71 0 return make_function('install', $message, %args);
72 0 ▶ } elsif (any { $command eq $_ } @Dist::Build::Core::EXPORT_OK) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
73 0 return make_function($command, $message, @args);
74 } else {
75 0 $self->SUPER::deserialize_action($serialized, %options);
76 }
77 }
78  
79 0 ▶sub make_function {
Subroutine make_function: not called CC=1 SCAR=6.9
Pod undocumented
80 0 my ($command, $message, @args) = @_;
81 0 ExtUtils::Builder::Action::Function->new(
82 function => $command,
83 module => 'Dist::Build::Core',
84 arguments => \@args,
85 exports => 'explicit',
86 message => $message,
87 );
88 }
89  
90 1 1;
91  
92 # ABSTRACT: A Serializer for a Dist::Build plan
93  
94 __END__
« blib/lib/Dist/Build/XS.pm ↑ Summary blib/lib/Dist/Build/XS/Alien.pm »