Hopen/G/CollectOp.pm

filter: Statementstmt 100% 27 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 100% 37 / 37 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Hopen/G/Link.pm ↑ Summary Hopen/G/NoOp.pm »
1 # Data::Hopen::G::CollectOp - pull values from scope(s)
2 package Data::Hopen::G::CollectOp;
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use Data::Hopen::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 9 our $VERSION = '0.000018';
7  
8 9 ▶use parent 'Data::Hopen::G::Op';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 use Class::Tiny {
10 9 levels => 'local',
11 9 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 9 ▶use Data::Hopen qw(:default UNSPECIFIED);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 9 ▶use Data::Hopen::Util::Data qw(clone forward_opts);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 9 ▶use Storable ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 # Docs {{{1
18  
19 =head1 NAME
20  
21 Data::Hopen::G::CollectOp - a passthrough operation
22  
23 =head1 SYNOPSIS
24  
25 An C<CollectOp> is a concrete L<Data::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<Data::Hopen::G::DAG> to represent goals.
28  
29 =head1 ATTRIBUTES
30  
31 =head2 levels
32  
33 Which levels of L<Data::Hopen::Scope> to pull from, as defined by
34 L<Data::Hopen::Scope/$levels>. Default is C<'local'>, i.e., to and including
35 the first Scope encountered that has L<local|Data::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<Data::Hopen::G::Runnable/passthrough> for more details.
51  
52 =cut
53  
54 sub _run {
55 28 ▶ my ($self, %args) = getparameters('self', [qw(*)], @_);
Subroutine _run: called CC=1 SCAR=0.0
56 28 return $self->passthrough(-nocontext => 1, -levels => $self->levels);
57 # -nocontext because Runnable::run() already hooked in the context
58 } #run()
59  
60 =head2 BUILD
61  
62 Constructor
63  
64 =cut
65  
66 sub BUILD {
67 30 ▶ my $self = shift;
Subroutine BUILD: called CC=1 SCAR=0.0
Pod documented
68 30 $self->want(UNSPECIFIED); # we'll take anything
69 }
70  
71 9 1;
72 __END__
« Hopen/G/Link.pm ↑ Summary Hopen/G/NoOp.pm »