Maker/Target/Group.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 63 CC 5 SCAR 15.9
CC
5
Cov
0%
can_make
6.0
should_make
6.0
fresh
6.0
CRAP 4.9
1 package Document::Maker::Target::Group;
2  
3 use Moose;
4  
5 with map { "Document::Maker::Role::$_" } qw/Component TargetMaker Dependency/;
6  
7 has targets => qw/is ro/, default => sub { [] };
8 has names => qw/is ro/, default => sub { [] };
9  
10 sub BUILD {
11 my $self = shift;
12 my $BUILD = shift;
13 }
14  
15 sub can_make {
16 my $self = shift;
17 my $name = shift;
18 for (@{ $self->names }) {
19 return $self if $name eq $_;
20 }
21 return undef;
22 }
23  
24 sub should_make {
25 my $self = shift;
26 return $self->fresh ? 0 : 1;
27 }
28  
29 sub fresh {
30 my $self = shift;
31 for my $target (@{ $self->targets }) {
32 return 0 unless $target->fresh;
33 }
34 return 1;
35 }
36  
37 sub freshness {
38 my $self = shift;
39 my $freshness;
40 for my $target (@{ $self->targets }) {
41 $freshness = $target->freshness if ! defined $target || $freshness > $target->freshness;
42 }
43 return $freshness || 0;
44 }
45  
46 sub make {
47 my $self = shift;
48 for my $target (@{ $self->targets }) {
49 $target->make;
50 }
51 }
52  
53 1;