File Coverage

blib/lib/Build/Hopen/G/Goal.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 4 50.0
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 30 32 93.7


line stmt bran cond sub pod time code
1             # Build::Hopen::G::Goal - A named build goal
2             package Build::Hopen::G::Goal;
3 3     3   1079 use Build::Hopen;
  3         6  
  3         141  
4 3     3   16 use Build::Hopen::Base;
  3         5  
  3         14  
5              
6             our $VERSION = '0.000006'; # TRIAL
7              
8 3     3   569 use parent 'Build::Hopen::G::Op';
  3         6  
  3         15  
9 3     3   142 use Class::Tiny qw(_passthrough);
  3         5  
  3         11  
10              
11             # Docs {{{1
12              
13             =head1 NAME
14              
15             Build::Hopen::G::Goal - a named goal in a hopen build
16              
17             =head1 SYNOPSIS
18              
19             A C is a named build target, e.g., C or C. The name C
20             is reserved for the root goal. Goals usually appear at the end of the build
21             graph, but this is not required --- Goal nodes can appear anywhere in the
22             graph.
23              
24             =head1 FUNCTIONS
25              
26             =head2 run
27              
28             Wraps a L's run function.
29              
30             =cut
31              
32             # }}}1
33              
34             sub run {
35 1 50   1 1 4 my $self = shift or croak 'Need an instance'; # Don't need Build::Hopen::Arrrgs
36 1         29 return $self->_passthrough->run(@_); # since this is straight forwarding
37             }
38              
39             =head2 BUILD
40              
41             =cut
42              
43             sub BUILD {
44 4     4 1 560 my ($self, $args) = @_;
45 4 50       14 croak 'Goals must have names' unless $args->{name};
46             # TODO refactor out the common code between Goal and PassthroughOp
47             # rather than wrapping.
48 4         21 my $p = hnew(PassthroughOp => ($args->{name} . '_inner'));
49 4         64 $self->_passthrough($p);
50 4         75 $self->want($p->want);
51 4         90 $self->need($p->need);
52             } #BUILD()
53              
54              
55             1;
56             __END__