GithubHelp home page GithubHelp logo

TRACE_VARS using hash extraction about template2 HOT 6 OPEN

abw avatar abw commented on June 23, 2024
TRACE_VARS using hash extraction

from template2.

Comments (6)

toddr avatar toddr commented on June 23, 2024

Looks like it stores as:

#   'VARIABLES' => {
#     'A' => {},
#     'B' => {
#       'C' => {}
#     }
#   }

from template2.

toddr avatar toddr commented on June 23, 2024

I don't necessarily see why you were expecting {A => {B => { C => {} } } }

from template2.

a-parser avatar a-parser commented on June 23, 2024

Just because [ A ] will expand keys in FOREACH scope and B.C will be accessible

from template2.

toddr avatar toddr commented on June 23, 2024

foreach is a loop. So you're iterating once with A as the $_; but then in the loop you're not doing $_.B.C You're doing B.C I don't see how A is implied. If it were implied, how would you display B.C if you wanted to?

from template2.

a-parser avatar a-parser commented on June 23, 2024

I can't found this in docs right now, but it's works for long time:

perl -e 'use Template; Template->new()->process(\"[% FOREACH [A]; B.C; END %]\n", {A => {B => {C => 42}}});'
42

And it is present in tests:
https://github.com/abw/Template2/blob/master/t/foreach.t#L370

from template2.

toddr avatar toddr commented on June 23, 2024

@a-parser I'm surprised it does that but it looks like this works now?

from template2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.