Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by marto (Cardinal)
on Jul 14, 2021 at 10:37 UTC ( [id://11134990]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11134990]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-16 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found