X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDX%2FRole%2FOp.pm;h=e4dc28181736e6f79d7674f8510211b916858a33;hb=a5c3a0416ea340dfaa9d9f83fa1a8bf9065766af;hp=83b9e8647e54775a664afc0e46b8616955d5bbb1;hpb=dd866f636c0c186462c15a9e8eca4b08babbc85b;p=scpubgit%2FDKit.git diff --git a/lib/DX/Role/Op.pm b/lib/DX/Role/Op.pm index 83b9e86..e4dc281 100644 --- a/lib/DX/Role/Op.pm +++ b/lib/DX/Role/Op.pm @@ -14,22 +14,26 @@ sub but { sub _expand_args { my ($self, $state, %spec) = @_; my %args; - @args{keys %spec} = map $self->_expand_argspec($state, $_), values %spec; + foreach my $key (keys %spec) { + ($state, $args{$key}) = $self->_expand_argspec($state, $spec{$key}); + } return $state->expand_vars(%args); } sub _expand_argspec { my ($self, $state, $spec) = @_; if (!ref($spec)) { - $state->scope_var($spec) + ($state->has_scope_var($spec) + ? ($state, $state->scope_var($spec)) + : (map { $_, $_->scope_var($spec) } $state->assign_vars($spec => {}))); } elsif (ref($spec) eq 'ARRAY') { if ($spec->[0] eq 'value') { - +{ bound_value => $spec->[1] }; + ($state, +{ bound_value => $spec->[1] }); } else { die "Arrayref in argspec is not value"; } } elsif (ref($spec) eq 'SCALAR' or ref($spec) eq 'REF') { - return +{ bound_value => $$spec }; + return ($state, +{ bound_value => $$spec }); } else { die "Argspec incomprehensible"; }