RFC: Template using PadWalker to access variables from inside task
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 737
- Forks
- 214
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
it would be possible with the PadWalker Module (https://metacpan.org/pod/PadWalker) to get the variables that the user declared inside a task. With this it would be possible to the something like this:
task "mytask", sub {
my $x = 5;
file "/tmp/foo.txt", content => template("mytemplate.tpl");
};
# the template
counter: <%= $x %>
So it would be possible to access the variables from inside a task in the template that gets parsed in the task. With this the user doesn't need to pass the variables to the template function.
What do you think about this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review how task callbacks invoke template() and how template variables are currently passed. Evaluate the PadWalker proposal and its implications for accessing task-local variables. Done would require an agreed design and maintainer decision on whether templates should support this behavior without explicit variable passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100