| 1 | # Build::Hopen::G::CollectOp - pull values from scope(s) | ||
| 2 | package Build::Hopen::G::CollectOp; | ||
| 3 | 3 | ▶ | use Build::Hopen qw(:default UNSPECIFIED); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use Build::Hopen::Base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | our $VERSION = '0.000008'; # TRIAL | |
| 7 | |||
| 8 | 3 | ▶ | use parent 'Build::Hopen::G::Op'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 3 | ▶ | use Class::Tiny { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 3 | levels => 'local', | |
| 11 | 3 | }; | |
| 12 | |||
| 13 | 3 | ▶ | use Build::Hopen::Util::Data qw(clone forward_opts); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 3 | ▶ | use Build::Hopen::Arrrgs; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 3 | ▶ | use Storable (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | # Docs {{{1 | ||
| 18 | |||
| 19 | =head1 NAME | ||
| 20 | |||
| 21 | Build::Hopen::G::CollectOp - a no-op | ||
| 22 | |||
| 23 | =head1 SYNOPSIS | ||
| 24 | |||
| 25 | An C<CollectOp> is a concrete L<Build::Hopen::G::Op> that passes its inputs, or | ||
| 26 | other values drawn from its scope, to its outputs unchanged. For example, | ||
| 27 | C<CollectOp> instances are used by L<Build::Hopen::G::DAG> to represent goals. | ||
| 28 | |||
| 29 | =head1 ATTRIBUTES | ||
| 30 | |||
| 31 | =head2 levels | ||
| 32 | |||
| 33 | Which levels of L<Build::Hopen::Scope> to pull from, as defined by | ||
| 34 | L<Build::Hopen::Scope/$levels>. Default is C<'local'>, i.e., to and including | ||
| 35 | the first Scope encountered that has L<local|Build::Hopen::Scope/local> set. | ||
| 36 | |||
| 37 | =cut | ||
| 38 | |||
| 39 | # }}}1 | ||
| 40 | |||
| 41 | =head1 FUNCTIONS | ||
| 42 | |||
| 43 | =head2 _run | ||
| 44 | |||
| 45 | Copy the inputs to the outputs. Usage: | ||
| 46 | |||
| 47 | my $hrOutputs = $op->run([-context=>$scope]) | ||
| 48 | |||
| 49 | The output is C<{}> if no inputs are provided. | ||
| 50 | See L<Build::Hopen::G::Runnable/passthrough> for more details. | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | 6 | ▶ | sub _run { |
|
Subroutine
_run: called CC=1 SCAR=0.2
| |||
| 55 | 6 | my ($self, %args) = parameters('self', [qw(*)], @_); | |
| 56 | 0 | ▶ | hlog { Running => __PACKAGE__ , $self->name }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 57 | 6 | return $self->passthrough(-nocontext => 1, -levels => $self->levels); | |
| 58 | # -nocontext because Runnable::run() already hooked in the context | ||
| 59 | } #run() | ||
| 60 | |||
| 61 | =head2 BUILD | ||
| 62 | |||
| 63 | Constructor | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | 5 | ▶ | sub BUILD { |
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
documented
| |||
| 68 | 5 | my $self = shift; | |
| 69 | 5 | $self->want(UNSPECIFIED); # we'll take anything | |
| 70 | } | ||
| 71 | |||
| 72 | 3 | 1; | |
| 73 | __END__ | ||