| 1 | 4 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 4 | ▶ | use warnings FATAL => 'recursion'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | package Daiku; | ||||||||||||||||||||
| 5 | 4 | ▶ | use 5.008001; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 4 | our $VERSION = '1.004'; | |||||||||||||||||||
| 7 | 4 | ▶ | use Daiku::Registry; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 4 | ▶ | use IPC::System::Simple (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 4 | ▶ | use Exporter qw(import); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 4 | our @EXPORT = our @EXPORT_OK = | |||||||||||||||||||
| 12 | qw(desc task file rule sh namespace engine build); | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 4 | my %engine_for = (); | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 9 | ▶ | sub _engine { | ||||||||||||||||||
|
Subroutine
_engine: called CC=2 SCAR=7.1
| |||||||||||||||||||||
| 17 | 9 | my ($caller_package) = @_; | |||||||||||||||||||
| 18 | 9 | ▶ | return ($engine_for{$caller_package} ||= Daiku::Registry->new()); | ||||||||||||||||||
|
Condition66%2/3
$engine_for{$caller_package} ||= "Daiku::Registry"->new
MC/DC0%0/2
$engine_for{$caller_package} ||= "Daiku::Registry"->new
$engine_for{$caller_package}
"Daiku::Registry"->new
Truth table66%2/3
A ||= B
A= $engine_for{$caller_package}B= "Daiku::Registry"->new
| |||||||||||||||||||||
| 19 | } | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 0 | ▶ | sub engine { | ||||||||||||||||||
|
Subroutine
engine: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 22 | 0 | return _engine(caller(0)); | |||||||||||||||||||
| 23 | } | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 0 | ▶ | sub desc($) { | ||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 26 | 0 | my $desc = shift; | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 0 | _engine(caller(0))->temporary_desc($desc); | |||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | # task 'all' => ['a', 'b']; | ||||||||||||||||||||
| 32 | # task 'all' => ['a', 'b'] => sub { ... }; | ||||||||||||||||||||
| 33 | 7 | ▶ | sub task($$;&) { | ||||||||||||||||||
|
Subroutine
task: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||
| 34 | 7 | my %args; | |||||||||||||||||||
| 35 | 7 | $args{dst} = shift @_; | |||||||||||||||||||
| 36 | 7 | ▶ | if (ref($_[-1]) eq 'CODE') { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 37 | 6 | $args{code} = pop @_; | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | 7 | ▶ | if (@_) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 40 | 2 | $args{deps} = shift @_; | |||||||||||||||||||
| 41 | 2 | ▶ | $args{deps} = [$args{deps}] if !ref $args{deps}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | 7 | my $engine = _engine(caller(0)); | |||||||||||||||||||
| 44 | 7 | my $desc = $engine->clear_temporary_desc; | |||||||||||||||||||
| 45 | 7 | ▶ | if (defined $desc) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 46 | 0 | $args{desc} = $desc; | |||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | 7 | $args{dst} = join ':', @{ $engine->namespaces }, $args{dst}; | |||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 7 | my $task = Daiku::Task->new( %args ); | |||||||||||||||||||
| 51 | 7 | $engine->register($task); | |||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | # file 'all' => ['a', 'b']; | ||||||||||||||||||||
| 55 | # file 'all' => 'a'; | ||||||||||||||||||||
| 56 | # file 'all' => ['a', 'b'] => sub { ... }; | ||||||||||||||||||||
| 57 | 0 | ▶ | sub file($$;&) { | ||||||||||||||||||
|
Subroutine
file: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||
| 58 | 0 | my %args; | |||||||||||||||||||
| 59 | 0 | $args{dst} = shift @_; | |||||||||||||||||||
| 60 | 0 | ▶ | if (ref($_[-1]) eq 'CODE') { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 61 | 0 | $args{code} = pop @_; | |||||||||||||||||||
| 62 | } | ||||||||||||||||||||
| 63 | 0 | ▶ | if (@_) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 64 | 0 | $args{deps} = shift @_; | |||||||||||||||||||
| 65 | 0 | ▶ | $args{deps} = [$args{deps}] if !ref $args{deps}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 66 | } | ||||||||||||||||||||
| 67 | 0 | my $file = Daiku::File->new( %args ); | |||||||||||||||||||
| 68 | 0 | _engine(caller(0))->register($file); | |||||||||||||||||||
| 69 | } | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | # rule '.c' => '.o' => sub { ... }; | ||||||||||||||||||||
| 72 | 0 | ▶ | sub rule($$;&) { | ||||||||||||||||||
|
Subroutine
rule: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 73 | 0 | my %args; | |||||||||||||||||||
| 74 | 0 | @args{qw/dst src code/} = @_; | |||||||||||||||||||
| 75 | 0 | ▶ | delete $args{code} unless defined $args{code}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 76 | 0 | my $rule = Daiku::SuffixRule->new( %args ); | |||||||||||||||||||
| 77 | 0 | _engine(caller(0))->register($rule); | |||||||||||||||||||
| 78 | } | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | 0 | ▶ | sub namespace($$) { | ||||||||||||||||||
|
Subroutine
namespace: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 81 | 0 | my ($namespace, $code) = @_; | |||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | 0 | my $engine = _engine(caller(0)); | |||||||||||||||||||
| 84 | 0 | push @{ $engine->namespaces }, $namespace; | |||||||||||||||||||
| 85 | 0 | $code->(); | |||||||||||||||||||
| 86 | 0 | pop @{ $engine->namespaces }; | |||||||||||||||||||
| 87 | } | ||||||||||||||||||||
| 88 | |||||||||||||||||||||
| 89 | 2 | ▶ | sub build { | ||||||||||||||||||
|
Subroutine
build: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 90 | 2 | _engine(caller(0))->build(@_); | |||||||||||||||||||
| 91 | } | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 4 | *sh = *IPC::System::Simple::run; | |||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | 4 | 1; | |||||||||||||||||||
| 97 | __END__ | ||||||||||||||||||||