http://qs1969.pair.com?node_id=11134990


in reply to Re: Mojo Template, passing dynamic index to array.
in thread Mojo Template, passing dynamic index to array.

Not sure why this got downvoted, passing a few variables with the values for the 'row' in question in most cases makes more sense than passing an entire data structure then displaying one 'row' from a result set.

  • Comment on Re^2: Mojo Template, passing dynamic index to array.

Replies are listed 'Best First'.
Re^3: Mojo Template, passing dynamic index to array.
by LanX (Saint) on Jul 16, 2021 at 16:32 UTC
    I understood $number as loop var, loading it into a temporary $street var would lead to more code.

    YMMV...

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      That's one way to look at it. Both are assumptions without OP providing proper context. I often see people pass large data structures to templates, only to never reference most of it.

        > I often see people pass large data structures to templates, only to never reference most of it.

        Is there really a memory impact? The "template" logic is not in a different process, right ?

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

Re^3: Mojo Template, passing dynamic index to array.
by Anonymous Monk on Jul 16, 2021 at 14:39 UTC

    Maybe because AnonyMonk in this case was inferring an XY problem when there really isn't one. The OP actually needs to know how to do what he was trying to do; offering him a kludgy workaround isn't doing him any favors.

      No 'work around' was offered, since the problem posted was addressed elsewhere in the thread. An alternative approach which makes perfect sense in common use cases.