blib/lib/Daiku/Role.pm

filter: Statementstmt 67.4% 29 / 43 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 72.7% 8 / 11 Podpod 0.0% 0 / 4 totaltotal 56.0% 37 / 66 CC 6 SCAR 18.8
CC
6
Cov
57%
merge
20.0
debug
6.0
clone
2.0
CRAP 6.6
« blib/lib/Daiku/File.pm ↑ Summary blib/lib/Daiku.pm »
1 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Daiku::Role;
6 5 ▶use Mouse::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use Scalar::Util qw/blessed/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 5 requires 'build';
11 5 requires 'match';
12  
13 5 has registry => (
14 is => 'rw',
15 isa => 'Maybe[Daiku::Registry]',
16 weak_ref => 1,
17 );
18  
19 sub clone {
20 1 ▶ my $self = shift;
Subroutine clone: called CC=2 SCAR=6.9
Pod undocumented
21  
22 1 my %args;
23 1 for my $attr ($self->meta->get_attribute_list) {
24 5 $args{$attr} = $self->$attr;
25 }
26 1 return $self->meta->name->new(%args);
27 }
28  
29 sub log {
30 7 ▶ my ($class, @msg) = @_;
Subroutine log: called CC=1 SCAR=0.0
Pod undocumented
31 7 print "[LOG] @msg\n";
32 }
33  
34 sub debug {
35 0 ▶ my ($class, @msg) = @_;
Subroutine debug: not called CC=2 SCAR=17.9
Pod undocumented
36 0 ▶ print "[LOG][DBG] @msg\n" if $ENV{DAIKU_DEBUG};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"DAIKU_DEBUG"} 0 0 0
37 }
38  
39 sub merge {
40 0 ▶ my ($self, $task) = @_;
Subroutine merge: not called CC=4 SCAR=30.0
Pod undocumented
41 0 ▶ return unless $task;
Branch: 1 branch
BranchTrueFalseTotal
unless $task 0 0 0
42  
43 0 ▶ Carp::croak("Cannot merge defferent type task: $task")
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($self) ne builtin::blessed($task) 0 0 0
44 if blessed($self) ne blessed($task);
45  
46 0 ▶ if ($self->can('deps')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can("deps")) 0 0 0
47 0 unshift @{$self->deps}, @{$task->deps};
48 }
49  
50 0 my $orig_code = $self->code();
51 0 my $other_code = $task->code();
52 $self->code(sub {
53 0 ▶ $other_code->(@_);
Subroutine __ANON__: not called CC=1 SCAR=6.9
54 0 $orig_code->(@_);
55 0 });
56 }
57  
58 5 1;
59  
« blib/lib/Daiku/File.pm ↑ Summary blib/lib/Daiku.pm »