| 1 | # Data::Hopen::G::Link - base class for hopen edges | ||||||||||
| 2 | package Data::Hopen::G::Link; | ||||||||||
| 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::Runnable'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | use Class::Tiny { | ||||||||||
| 10 | 9 | greedy => 0 | |||||||||
| 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); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | =head1 NAME | ||||||||||
| 17 | |||||||||||
| 18 | Data::Hopen::G::Link - The base class for all hopen links between ops. | ||||||||||
| 19 | |||||||||||
| 20 | =head1 VARIABLES | ||||||||||
| 21 | |||||||||||
| 22 | =head2 greedy | ||||||||||
| 23 | |||||||||||
| 24 | If set truthy in the C<new()> call, the edge will ask for all inputs. | ||||||||||
| 25 | |||||||||||
| 26 | =head1 FUNCTIONS | ||||||||||
| 27 | |||||||||||
| 28 | =head2 run | ||||||||||
| 29 | |||||||||||
| 30 | Copy the inputs to the outputs. | ||||||||||
| 31 | |||||||||||
| 32 | my $hrOutputs = $op->run($scope) | ||||||||||
| 33 | |||||||||||
| 34 | The output is C<{}> if no inputs are provided. | ||||||||||
| 35 | |||||||||||
| 36 | By default, the output is a copy of the inputs | ||||||||||
| 37 | (see L<Data::Hopen::G::Runnable/passthrough>). | ||||||||||
| 38 | |||||||||||
| 39 | =cut | ||||||||||
| 40 | |||||||||||
| 41 | sub _run { | ||||||||||
| 42 | 2 | ▶ | my ($self, %args) = getparameters('self', [qw(; phase visitor)], @_); | ||||||||
|
Subroutine
_run: called CC=1 SCAR=0.0
| |||||||||||
| 43 | 2 | return $self->passthrough(-nocontext => 1); | |||||||||
| 44 | } #run() | ||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | =head2 BUILD | ||||||||||
| 48 | |||||||||||
| 49 | Constructor. Interprets L</greedy>. | ||||||||||
| 50 | |||||||||||
| 51 | =cut | ||||||||||
| 52 | |||||||||||
| 53 | sub BUILD { | ||||||||||
| 54 | 12 | ▶ | my ($self, $args) = @_; | ||||||||
|
Subroutine
BUILD: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 55 | 12 | ▶ | $self->want(UNSPECIFIED) if $args->{greedy}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | #hlog { 'Link::BUILD', Dumper($self), Dumper($args) }; | ||||||||||
| 57 | #hlog { 'Link::BUILD', Dumper($self->scope) }; | ||||||||||
| 58 | } #BUILD() | ||||||||||
| 59 | |||||||||||
| 60 | 9 | 1; | |||||||||
| 61 | __END__ | ||||||||||