fix(tools): allow reference to children of in execute operation of access module

main
Tsu-ba-me 9 months ago
parent 104b158426
commit b5264131c4
  1. 14
      tools/anvil-access-module

@ -208,6 +208,20 @@ sub access_chain
# On the last key of the chain; try to execute the subroutine if it exists # On the last key of the chain; try to execute the subroutine if it exists
if ($is_last_key) if ($is_last_key)
{ {
# Go through each argument and replace any 'anvil->' strings with their real value.
# At the time of writing, the only expected use case is calling $anvil->_make_hash_reference
for my $arg_i (0 .. $#{$chain_args})
{
my $arg = $chain_args->[$arg_i];
if ($arg =~ s/^anvil(->|\.)//)
{
my ($replacement) = access_chain({ chain => $arg, debug => $debug });
$chain_args->[$arg_i] = $replacement;
}
}
# Trailing 1 means the eval block will return success if the subroutine and assign succeeded # Trailing 1 means the eval block will return success if the subroutine and assign succeeded
eval { (@results) = $intermediate->${key}(@$chain_args); 1; }; eval { (@results) = $intermediate->${key}(@$chain_args); 1; };

Loading…
Cancel
Save