| 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
| |||||||||||
| 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
| |||||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | Carp::croak("Cannot merge defferent type task: $task") | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | if blessed($self) ne blessed($task); | ||||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | if ($self->can('deps')) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | |||||||||||