diff --git a/Changes b/Changes index 99a53df..65038e2 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Data-Hopen +0.000019 2020-12-26 + - No longer treat -phase specially when running DAGs. + 0.000018 2020-05-14 - Fix dependencies (again) (cpantesters++) diff --git a/README.md b/README.md index 8849ac4..be6ec01 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ `Data::Hopen` is a dataflow library that runs actions you specify, moves data between those actions, and permits transforming data as the data moves. It is -the underlying engine of the [App::hopen](https://metacpan.org/pod/App::hopen) cross-platform software build +the underlying engine of the [App::hopen](https://metacpan.org/pod/App%3A%3Ahopen) cross-platform software build generator, but can be used for any dataflow task that can be represented as a directed acyclic graph (DAG). diff --git a/lib/Data/Hopen/G/DAG.pm b/lib/Data/Hopen/G/DAG.pm index 3c45be0..88ebb9c 100644 --- a/lib/Data/Hopen/G/DAG.pm +++ b/lib/Data/Hopen/G/DAG.pm @@ -142,7 +142,7 @@ the order those predecessors were added to the graph. # The implementation of run(). $self->scope has already been linked to the context. sub _run { - my ($self, %args) = getparameters('self', [qw(; phase visitor)], @_); + my ($self, %args) = getparameters('self', [qw(; visitor)], @_); my $retval = {}; # --- Get the initialization ops --- @@ -269,7 +269,6 @@ sub _run { $hrLinkOutputs = $link->run( -context=>$scLinkInputs, - forward_opts(\%args, {'-'=>1}, 'phase') # visitor not passed to links. ); $scLinkInputs = make_link_inputs($hrLinkOutputs); @@ -281,7 +280,7 @@ sub _run { } #foreach predecessor node my $step_output = $node->run(-context=>$node_inputs, - forward_opts(\%args, {'-'=>1}, 'phase', 'visitor') + forward_opts(\%args, {'-'=>1}, 'visitor') ); $node->outputs($step_output); diff --git a/lib/Data/Hopen/G/Goal.pm b/lib/Data/Hopen/G/Goal.pm index bdbc95c..95b5c99 100644 --- a/lib/Data/Hopen/G/Goal.pm +++ b/lib/Data/Hopen/G/Goal.pm @@ -45,14 +45,14 @@ Passes through the inputs if L is set. # }}}1 sub _run { - my ($self, %args) = getparameters('self', [qw(; phase visitor)], @_); + my ($self, %args) = getparameters('self', [qw(; visitor)], @_); hlog { Goal => $self->name, ($self->should_output ? 'with' : 'without'), 'outputs' }; return {} unless $self->should_output; return $self->passthrough(-nocontext=>1, -levels => 'local', - forward_opts(\%args, {'-'=>1}, qw[phase visitor])); + forward_opts(\%args, {'-'=>1}, qw[visitor])); } #_run() =head2 BUILD diff --git a/lib/Data/Hopen/G/Link.pm b/lib/Data/Hopen/G/Link.pm index 72de824..3abc58c 100644 --- a/lib/Data/Hopen/G/Link.pm +++ b/lib/Data/Hopen/G/Link.pm @@ -39,7 +39,7 @@ By default, the output is a copy of the inputs =cut sub _run { - my ($self, %args) = getparameters('self', [qw(; phase visitor)], @_); + my ($self, %args) = getparameters('self', [qw(; visitor)], @_); return $self->passthrough(-nocontext => 1); } #run() diff --git a/lib/Data/Hopen/G/Runnable.pm b/lib/Data/Hopen/G/Runnable.pm index b4c9a62..30d9f3d 100644 --- a/lib/Data/Hopen/G/Runnable.pm +++ b/lib/Data/Hopen/G/Runnable.pm @@ -77,10 +77,6 @@ A L or subclass including the inputs the caller wants to pass to the Runnable. The L of the Runnable itself may override values in the C. -=item -phase - -If given, the phase that is currently under way in a build-system run. - =item -visitor If given, an instance that supports C and C calls. @@ -106,7 +102,7 @@ scope. =cut sub run { - my ($self, %args) = getparameters('self', [qw(; context phase visitor nocontext)], @_); + my ($self, %args) = getparameters('self', [qw(; context visitor nocontext)], @_); my $context_scope = $args{context}; # which may be undef - that's OK croak "Can't combine -context and -nocontext" if $args{context} && $args{nocontext}; @@ -115,7 +111,7 @@ sub run { hlog { '->', ref($self), $self->name, 'input', Dumper($self->scope->as_hashref) } 3; - my $retval = $self->_run(forward_opts(\%args, {'-'=>1}, qw[phase visitor])); + my $retval = $self->_run(forward_opts(\%args, {'-'=>1}, qw[visitor])); die "$self\->_run() did not return a hashref" unless ref $retval eq 'HASH'; # Prevent errors about `non-hashref 1` or `invalid key`. @@ -131,13 +127,13 @@ The internal method that implements L. Must be implemented by subclasses. When C<_run> is called, C<< $self->scope >> has been hooked to the context scope, if any. -Parameters are C<-phase> and C<-visitor>, and are always passed by name -(C<< -phase=>$p, -visitor=>$v >>). C<_run> is always called in scalar context, +The only parameter is C<-visitor>, which is always passed by name +(C<< -visitor=>$v >>). C<_run> is always called in scalar context, and B return a new hashref. I recommend starting your C<_run> function with: - my ($self, %args) = getparameters('self', [qw(; phase visitor)], @_); + my ($self, %args) = getparameters('self', [qw(; visitor)], @_); and working from there. diff --git a/t/125-dag-links.t b/t/125-dag-links.t index 0afc588..5f2b7fa 100644 --- a/t/125-dag-links.t +++ b/t/125-dag-links.t @@ -34,7 +34,7 @@ sub make_dag { # See t/121-dag-single-goal.t for the explanation of this use Data::Hopen; use parent 'Data::Hopen::G::Link'; sub _run { - my ($self, %args) = getparameters('self', [qw(; phase visitor)], @_); + my ($self, %args) = getparameters('self', [qw(; visitor)], @_); return { xyzzy => 'plugh' }; } } @@ -46,7 +46,7 @@ sub make_dag { # See t/121-dag-single-goal.t for the explanation of this use Class::Tiny {to_add => sub { +{ xyzzy => 'plugh' } } }; sub _run { - my ($self, %args) = getparameters('self', [qw(; phase visitor)], @_); + my ($self, %args) = getparameters('self', [qw(; visitor)], @_); my $inputs = $self->scope->as_hashref(-levels => 3); return +{ %$inputs, %{$self->to_add} }; } @@ -57,7 +57,7 @@ sub make_dag { # See t/121-dag-single-goal.t for the explanation of this use Data::Hopen; use parent 'Data::Hopen::G::Link'; sub _run { - my ($self, %args) = getparameters('self', [qw(; phase visitor)], @_); + my ($self, %args) = getparameters('self', [qw(; visitor)], @_); my $inputs = $self->scope->as_hashref; my $multiplier = $inputs->{multiplier} // 2; $inputs->{foo} *= $multiplier if exists $inputs->{foo};