diff --git a/.appveyor.yml b/.appveyor.yml index 0982505..c9ac486 100755 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -72,4 +72,3 @@ for: # Then, install cpanminus locally so it will be cached. - which cpanm || (curl -L https://cpanmin.us | perl - App::cpanminus) - diff --git a/Changes b/Changes index 3dcf769..365afd9 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,11 @@ Revision history for Data-Hopen +0.000011 2019-02-28 + Bugfixes in Scope + +0.000010 2019-02-14 + Finished removing code now in App::hopen + 0.000009 2019-02-13 Renamed from Build::Hopen to Data::Hopen diff --git a/Makefile.PL b/Makefile.PL index 92737cb..402b749 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -9,6 +9,8 @@ use File::Spec; my $VERSION_FROM = File::Spec->catfile(qw(lib Data Hopen.pm)); my $IS_TRIAL = check_trial(); +my $secure_perl_path = get_perl_filename(); +my @provides = (); # Check if this is a TRIAL version {{{1 sub check_trial { @@ -26,16 +28,18 @@ sub check_trial { } return 0; } #check_trial() + # }}}1 # Module metadata {{{1 -my $provides; eval { require Module::Metadata; - $provides = Module::Metadata->provides(version => '2', dir => 'lib'); + @provides = + (provides => Module::Metadata->provides(version => '2', dir => 'lib')); # Thanks to https://stackoverflow.com/a/28928985/2877364 by LEONT + # for the suggestion to use Module::Metadata }; -# }}}1 +# }}}1 # Get the filename of the Perl interpreter running this. {{{1 # Modified from perlvar. # The -x test is for cygwin or other systems where $Config{perlpath} has no @@ -49,10 +53,9 @@ sub get_perl_filename { ($secure_perl_path =~ m/$Config{_exe}$/i); } return $secure_perl_path; -} # get_perl_filename() }}}1 - -my $secure_perl_path = get_perl_filename(); +} # get_perl_filename() +# }}}1 # Makefile customization (MY) {{{1 { package MY; @@ -133,7 +136,9 @@ actually_uninstall_from_vendordirs :: EOT } #postamble() -} #package MY }}}1 +} #package MY + +# }}}1 # Main options for EUMM my %opts = ( @@ -154,6 +159,8 @@ my %opts = ( # In the following, if a specific version is listed, but no explanation # is given, that means we want that version for bugfixes it includes. + # Prereqs commented out with "##" were used at one time but no longer + # appear to be. CONFIGURE_REQUIRES => { 'Config' => '0', 'ExtUtils::MakeMaker' => '0', @@ -172,7 +179,7 @@ my %opts = ( 'rlib' => '0', 'Scalar::Util' => '0', 'Test::Deep' => '0.084', # for superhashof - 'Test::Directory' => '0.02', # for subdirs + ## 'Test::Directory' => '0.02', # for subdirs 'Test::More' => '0', # Test::TempDir::Tiny? If so, remove Test::Directory dependency? }, @@ -193,31 +200,30 @@ my %opts = ( #'Class::Method::Modifiers' => '1.05', # version nums from Antlers #'Role::Tiny' => '1.000000', - 'Class::XPath' => '1.4', + ## 'Class::XPath' => '1.4', 'Config' => '0', - 'Cwd' => '0', + #'Cwd' => '0', 'constant' => '0', 'Data::Dumper' => '0', - 'Deep::Hash::Utils' => '0.03', # For correct metadata + ## 'Deep::Hash::Utils' => '0.03', # For correct metadata 'experimental' => '0.009', # For support on perl < 5.15.7 'Exporter' => '0', 'feature' => '0', # 'File::Find::Rule' => '0', # - might be nice for finding files - 'File::Glob' => '0', + #'File::Glob' => '0', #'File::Globstar' => '0.5', # Fewer dependencies - 'File::Path::Tiny' => '0.9', + ## 'File::Path::Tiny' => '0.9', 'File::Spec' => '0', - 'File::stat' => '0', - 'File::Which' => '1.22', # for msys2 support + ## 'File::stat' => '0', + ## 'File::Which' => '1.22', # for msys2 support 'Hash::Merge' => '0.299', - 'Hash::Ordered' => '0.011', + ## 'Hash::Ordered' => '0.011', 'Import::Into' => '0', - 'IO::Handle' => '0', 'Getargs::Mixed' => '1.04', # For -undef_ok option 'Getopt::Long' => '2.5', # For long option bugfix 'Graph' => '0.9704', # For latest multiedged support - 'List::MoreUtils' => '0.428', + ## 'List::MoreUtils' => '0.428', # 'Module::Find' => '0.12', # For bugfixes # - Use for finding plugins to load. @@ -230,7 +236,7 @@ my %opts = ( 'overload' => '0', - 'Package::Alias' => '0.12', + ## 'Package::Alias' => '0.12', # 'Parse::RecDescent' => '1.967015', # - Use for parsing Lua tables as inline config data? @@ -241,7 +247,7 @@ my %opts = ( # precedence in P::RD grammars. 'Path::Class' => '0.37', - 'Pod::Usage' => '0', + ## 'Pod::Usage' => '0', # 'Probe::Perl' => '0', # For perl interpreter file location or other info. # Alternative: Padre::Perl @@ -280,7 +286,7 @@ my %opts = ( }, }, - $provides ? (provides => $provides) : (), + @provides, }, #META_MERGE diff --git a/lib/Data/Hopen.pm b/lib/Data/Hopen.pm index c64d86e..34bdf1c 100644 --- a/lib/Data/Hopen.pm +++ b/lib/Data/Hopen.pm @@ -22,7 +22,7 @@ use Data::Hopen::Util::NameSet; use Getargs::Mixed; use Storable (); -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL # Docs {{{1 diff --git a/lib/Data/Hopen/Base.pm b/lib/Data/Hopen/Base.pm index f65d26c..0aa95a0 100755 --- a/lib/Data/Hopen/Base.pm +++ b/lib/Data/Hopen/Base.pm @@ -8,7 +8,7 @@ package Data::Hopen::Base; use parent 'Exporter'; use Import::Into; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL # Pragmas use 5.014; diff --git a/lib/Data/Hopen/G/CollectOp.pm b/lib/Data/Hopen/G/CollectOp.pm index 97cf470..5ea432a 100755 --- a/lib/Data/Hopen/G/CollectOp.pm +++ b/lib/Data/Hopen/G/CollectOp.pm @@ -2,7 +2,7 @@ package Data::Hopen::G::CollectOp; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use parent 'Data::Hopen::G::Op'; use Class::Tiny { diff --git a/lib/Data/Hopen/G/DAG.pm b/lib/Data/Hopen/G/DAG.pm index 9e3cc98..15ae25a 100755 --- a/lib/Data/Hopen/G/DAG.pm +++ b/lib/Data/Hopen/G/DAG.pm @@ -2,7 +2,7 @@ package Data::Hopen::G::DAG; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use parent 'Data::Hopen::G::Op'; use Class::Tiny { diff --git a/lib/Data/Hopen/G/Entity.pm b/lib/Data/Hopen/G/Entity.pm index e25cfd4..5b7e444 100755 --- a/lib/Data/Hopen/G/Entity.pm +++ b/lib/Data/Hopen/G/Entity.pm @@ -3,7 +3,7 @@ package Data::Hopen::G::Entity; use Data::Hopen; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL sub name; diff --git a/lib/Data/Hopen/G/Goal.pm b/lib/Data/Hopen/G/Goal.pm index 047cbf5..e1e10e8 100755 --- a/lib/Data/Hopen/G/Goal.pm +++ b/lib/Data/Hopen/G/Goal.pm @@ -2,10 +2,13 @@ package Data::Hopen::G::Goal; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use parent 'Data::Hopen::G::Op'; -#use Class::Tiny qw(_passthrough); +use Class::Tiny { + should_output => true, # if true, forward the goal's inputs as + # its outputs. +}; use Data::Hopen; use Data::Hopen::Util::Data qw(forward_opts); @@ -23,11 +26,18 @@ is reserved for the root goal. Goals usually appear at the end of the build graph, but this is not required --- Goal nodes can appear anywhere in the graph. +=head1 MEMBERS + +=head2 should_output + +Boolean, default true. If false, the goal's outputs are always C<{}> (empty). +If true, the goal's inputs are passed through as outputs. + =head1 FUNCTIONS =head2 run -Wraps a L's run function. +Passes through the inputs if L is set. =cut @@ -35,7 +45,11 @@ Wraps a L's run function. sub _run { my ($self, %args) = getparameters('self', [qw(; phase generator)], @_); - hlog { Goal => $self->name }; + 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 generator])); } #_run() diff --git a/lib/Data/Hopen/G/GraphBuilder.pm b/lib/Data/Hopen/G/GraphBuilder.pm index 81f3fc2..756c1ee 100755 --- a/lib/Data/Hopen/G/GraphBuilder.pm +++ b/lib/Data/Hopen/G/GraphBuilder.pm @@ -6,14 +6,13 @@ use Exporter 'import'; our @EXPORT; BEGIN { @EXPORT=qw(make_GraphBuilder); } -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use Class::Tiny { - name => sub { 'ANON' }, # Name is optional; it's here so the - # constructor won't croak if you use one. - - dag => undef, - node => undef, + name => 'ANON', # Name is optional; it's here so the + # constructor won't croak if you use one. + dag => undef, # The current G::DAG instance + node => undef, # The last node added }; use Class::Method::Modifiers qw(install_modifier); diff --git a/lib/Data/Hopen/G/Link.pm b/lib/Data/Hopen/G/Link.pm index 9eb3b40..b23e026 100755 --- a/lib/Data/Hopen/G/Link.pm +++ b/lib/Data/Hopen/G/Link.pm @@ -2,7 +2,7 @@ package Data::Hopen::G::Link; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use parent 'Data::Hopen::G::Runnable'; use Class::Tiny { diff --git a/lib/Data/Hopen/G/Node.pm b/lib/Data/Hopen/G/Node.pm index 58098fa..e5aef2f 100755 --- a/lib/Data/Hopen/G/Node.pm +++ b/lib/Data/Hopen/G/Node.pm @@ -3,7 +3,7 @@ package Data::Hopen::G::Node; use Data::Hopen; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL sub outputs; diff --git a/lib/Data/Hopen/G/Op.pm b/lib/Data/Hopen/G/Op.pm index 25f45b7..53afc1c 100644 --- a/lib/Data/Hopen/G/Op.pm +++ b/lib/Data/Hopen/G/Op.pm @@ -3,7 +3,7 @@ package Data::Hopen::G::Op; use Data::Hopen; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use parent 'Data::Hopen::G::Node'; use Class::Tiny; diff --git a/lib/Data/Hopen/G/Runnable.pm b/lib/Data/Hopen/G/Runnable.pm index df99611..0602fbb 100755 --- a/lib/Data/Hopen/G/Runnable.pm +++ b/lib/Data/Hopen/G/Runnable.pm @@ -2,7 +2,7 @@ package Data::Hopen::G::Runnable; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use Data::Hopen; use Data::Hopen::Scope::Hash; diff --git a/lib/Data/Hopen/Scope.pm b/lib/Data/Hopen/Scope.pm index 32eb742..d2ee58f 100755 --- a/lib/Data/Hopen/Scope.pm +++ b/lib/Data/Hopen/Scope.pm @@ -3,7 +3,7 @@ package Data::Hopen::Scope; use Data::Hopen::Base; use Exporter 'import'; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL # Class definition use Class::Tiny { @@ -24,10 +24,10 @@ sub FIRST_ONLY { $_first_only } use constant _LOCAL => 'local'; # What we use -use Data::Hopen qw(getparameters); use Config; -use POSIX (); +use Data::Hopen qw(getparameters); use Data::Hopen::Util::Data qw(clone forward_opts); +use POSIX (); use Set::Scalar; use Sub::ScopeFinalizer qw(scope_finalizer); @@ -143,14 +143,14 @@ See also L, below, which is part of the public API. # Handle $levels and invoke a function on the outer scope if appropriate. # Usage: -# $self->_invoke(coderef, $levels, [other args to be passed, starting with -# invocant, if any] +# $self->_invoke('method_name', $levels, [other args to be passed, starting +# with invocant, if any] # A new levels value will be added to the end of the args as -levels=>$val. # Returns undef if there's no more traversing to be done. sub _invoke { my $self = shift or croak 'Need an instance'; - my $coderef = shift or croak 'Need a coderef'; + my $method_name = shift or croak 'Need a method name'; my $levels = shift; # Handle 'local'-scoped searches by terminating when $self->local is set. @@ -166,7 +166,8 @@ sub _invoke { unshift @_, $self->outer; push @_, -levels => $newlevels; - goto &$coderef; + my $coderef = $self->outer->can($method_name); + return $coderef->(@_) if $coderef; } return undef; } #_invoke() @@ -191,11 +192,10 @@ sub find { # Therefore, '0' is not a valid name my $levels = $args{levels}; - $DB::single=1; my $here = $self->_find_here($args{name}, $args{set}); return $here if defined $here; - return $self->_invoke(\&find, $args{levels}, + return $self->_invoke('find', $args{levels}, forward_opts(\%args, {'-'=>1}, qw(name set)) ); } #find() @@ -230,7 +230,7 @@ sub _fill_names { $self->_names_here($args{retval}); # Insert this scope's names - return $self->_invoke(\&_fill_names, $args{levels}, -retval=>$args{retval}); + return $self->_invoke('_fill_names', $args{levels}, -retval=>$args{retval}); } #_fill_names() =head2 as_hashref @@ -259,20 +259,23 @@ sub as_hashref { } #as_hashref() # Implementation of as_hashref. Mutates the provided $hrRetval. -# TODO move this to subclasses. sub _fill_hashref { my ($self, %args) = getparameters('self', [qw(retval levels deep)], @_); my $hrRetval = $args{retval}; # Innermost wins, so copy ours first. - foreach my $k (keys %{$self->_content}) { + my $names = Set::Scalar->new; + $self->_names_here($names); + + foreach my $k (@$names) { unless(exists($hrRetval->{$k})) { # An inner scope might have set it + my $val = $self->find($k, -levels => 0); $hrRetval->{$k} = - ($args{deep} ? clone($self->_content->{$k}) : $self->_content->{$k}); + ($args{deep} ? clone($val) : $val); } } - return $self->_invoke(\&_fill_hashref, $args{levels}, + return $self->_invoke('_fill_hashref', $args{levels}, forward_opts(\%args, {'-'=>1}, qw(retval deep))); } #_fill_hashref() diff --git a/lib/Data/Hopen/Scope/Environment.pm b/lib/Data/Hopen/Scope/Environment.pm index acf0877..c6e3992 100755 --- a/lib/Data/Hopen/Scope/Environment.pm +++ b/lib/Data/Hopen/Scope/Environment.pm @@ -2,7 +2,7 @@ package Data::Hopen::Scope::Environment; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use parent 'Data::Hopen::Scope'; diff --git a/lib/Data/Hopen/Scope/Hash.pm b/lib/Data/Hopen/Scope/Hash.pm index 1e3f4e1..798f4ef 100755 --- a/lib/Data/Hopen/Scope/Hash.pm +++ b/lib/Data/Hopen/Scope/Hash.pm @@ -2,7 +2,7 @@ package Data::Hopen::Scope::Hash; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use parent 'Data::Hopen::Scope'; use Class::Tiny { diff --git a/lib/Data/Hopen/Scope/Inputs.pm b/lib/Data/Hopen/Scope/Inputs.pm index 5e64db2..126d783 100644 --- a/lib/Data/Hopen/Scope/Inputs.pm +++ b/lib/Data/Hopen/Scope/Inputs.pm @@ -3,7 +3,7 @@ package Data::Hopen::Scope::Inputs; use Data::Hopen; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL # TODO if a class use parent 'Data::Hopen::Scope'; diff --git a/lib/Data/Hopen/Scope/Overrides.pm b/lib/Data/Hopen/Scope/Overrides.pm index f15a76f..2d763bb 100755 --- a/lib/Data/Hopen/Scope/Overrides.pm +++ b/lib/Data/Hopen/Scope/Overrides.pm @@ -3,7 +3,7 @@ package Data::Hopen::Scope::Overrides; use Data::Hopen; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL # TODO if using exporter use parent 'Exporter'; diff --git a/lib/Data/Hopen/TEMPLATE.pm b/lib/Data/Hopen/TEMPLATE.pm index 3b41670..8ddbcc2 100755 --- a/lib/Data/Hopen/TEMPLATE.pm +++ b/lib/Data/Hopen/TEMPLATE.pm @@ -3,7 +3,7 @@ package Data::Hopen::TEMPLATE; use Data::Hopen; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL # TODO if using exporter use parent 'Exporter'; diff --git a/lib/Data/Hopen/Util/Data.pm b/lib/Data/Hopen/Util/Data.pm index 3e3dec7..9bae072 100755 --- a/lib/Data/Hopen/Util/Data.pm +++ b/lib/Data/Hopen/Util/Data.pm @@ -3,7 +3,7 @@ package Data::Hopen::Util::Data; use Data::Hopen; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use parent 'Exporter'; our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS); diff --git a/lib/Data/Hopen/Util/Filename.pm b/lib/Data/Hopen/Util/Filename.pm index 5b02769..d882d52 100755 --- a/lib/Data/Hopen/Util/Filename.pm +++ b/lib/Data/Hopen/Util/Filename.pm @@ -2,7 +2,7 @@ package Data::Hopen::Util::Filename; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL use parent 'Exporter'; our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS); diff --git a/lib/Data/Hopen/Util/NameSet.pm b/lib/Data/Hopen/Util/NameSet.pm index a2e5f06..facac14 100755 --- a/lib/Data/Hopen/Util/NameSet.pm +++ b/lib/Data/Hopen/Util/NameSet.pm @@ -2,7 +2,7 @@ package Data::Hopen::Util::NameSet; use Data::Hopen::Base; -our $VERSION = '0.000010'; +our $VERSION = '0.000011'; # TRIAL # Docs {{{1 diff --git a/t/021-dag-single-goal.t b/t/021-dag-single-goal.t index c2e485c..fe2f647 100755 --- a/t/021-dag-single-goal.t +++ b/t/021-dag-single-goal.t @@ -35,7 +35,6 @@ sub run { # Run it #print Dumper($outermost_scope); -$DB::single = 1; my $dag_out = $dag->run($outermost_scope); #print Dumper($dag_out); #print Dumper($op->outputs);