File Coverage

blib/lib/Data/Hopen/G/CollectOp.pm
Criterion Covered Total %
statement 25 25 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 1 1 100.0
total 35 35 100.0


line stmt bran cond sub pod time code
1             # Data::Hopen::G::CollectOp - pull values from scope(s)
2             package Data::Hopen::G::CollectOp;
3 9     9   623 use strict;
  9         22  
  9         276  
4 9     9   53 use Data::Hopen::Base;
  9         17  
  9         61  
5              
6             our $VERSION = '0.000019';
7              
8 9     9   2109 use parent 'Data::Hopen::G::Op';
  9         21  
  9         49  
9             use Class::Tiny {
10 9         54 levels => 'local',
11 9     9   561 };
  9         21  
12              
13 9     9   2129 use Data::Hopen qw(:default UNSPECIFIED);
  9         22  
  9         1064  
14 9     9   63 use Data::Hopen::Util::Data qw(clone forward_opts);
  9         16  
  9         450  
15 9     9   57 use Storable ();
  9         16  
  9         1409  
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 is a concrete L that passes its inputs, or
26             other values drawn from its scope, to its outputs unchanged. For example,
27             C instances are used by L to represent goals.
28              
29             =head1 ATTRIBUTES
30              
31             =head2 levels
32              
33             Which levels of L to pull from, as defined by
34             L. Default is C<'local'>, i.e., to and including
35             the first Scope encountered that has L 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 for more details.
51              
52             =cut
53              
54             sub _run {
55 28     28   143 my ($self, %args) = getparameters('self', [qw(*)], @_);
56 28         1764 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     30 1 3953 my $self = shift;
68 30         158 $self->want(UNSPECIFIED); # we'll take anything
69             }
70              
71             1;
72             __END__