Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Doubt about Template Toolkit

by hippo (Bishop)
on Jul 14, 2022 at 16:42 UTC ( [id://11145528]=note: print w/replies, xml ) Need Help??


in reply to Doubt about Template Toolkit

Your provided code doesn't actually define %referencesData so maybe it only has one key?

Here's an SSCCE showing TT running successfully in a loop.

#!/usr/bin/env perl use strict; use warnings; use Template; my $tt = "value = [% thing %]\n"; my $template = Template->new; for my $this (qw/foo bar baz/) { $template->process (\$tt, { thing => $this }); }

🦛

Replies are listed 'Best First'.
Re^2: Doubt about Template Toolkit
by logangha (Acolyte) on Jul 14, 2022 at 23:08 UTC

    Thanks for your quick answer hippo. This is %referencesData content:

    $VAR1 = { 'C02-2003-0263' => 'https://10.94.249.177:16311/ibm/console/ +webtop/AELView?sql=((TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeName%20 +=%20\'CTJAXM7300W\'%20and%20PhysicalSlot%20=%201%20and%20PhysicalPort +=%203)%20or%20(TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeName=%20\'CTJ +AXM7300W\'%20and%20PhysicalPort%20=%200))%20or%20(TMX_NodeName%20!=%2 +0\'\'%20and%20TMX_NodeName%20=%20\'CTJAXM7300W\'%20and%20PhysicalSlot +%20=%201%20and%20PhysicalPort%20=%201)%20or%20((TMX_NodeName%20!=%20\ +'\'%20and%20TMX_NodeName%20=%20\'TTTNXMCL05W\'%20and%20PhysicalSlot%2 +0=%2001%20and%20PhysicalPort%20=%209)%20%20or%20(TMX_NodeName%20!=%20 +\'\'%20and%20TMX_NodeName=%20\'TTTNXMCL05W\'%20and%20PhysicalPort%20= +%200))%20or%20((TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeName%20=%20\ +'TTTNXMCL05W\'%20and%20PhysicalSlot%20=%2017%20and%20PhysicalPort%20= +%201)%20or%20(TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeName%20=%20\'T +TTNXMCL05W\'%20and%20PhysicalSlot%20=%200%20and%20PhysicalPort%20=%20 +0))%20or%20((TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeName%20=%20\'TT +TNXMCLO01-AGR3-06\'%20%20and%20PhysicalSlot%20=%2003%20and%20Physical +Port%20=%207%20)%20or%20(TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeNam +e%20=%20\'TTTNXMCLO01-AGR3-06\'%20%20and%20PhysicalSlot%20=%200%20and +%20PhysicalPort%20=%200%20AND%20(AlertGroup%20IN%20(\'ReachabilityPro +blem\',%20\'component%20unreachable\',\'ER%20CEth%20Inalcanzable\')%2 +0OR%20AlertGroup%20%20LIKE%20\'[Pp]ower\'))%20)%20or%20(TMX_NodeName% +20=%20\'TTTNXMCLO01-AGR3-06\'%20and%20PhysicalSlot%20=%2003%20and%20P +hysicalPort%20=%200)%20or%20(TMX_NodeName%20=%20\'TTTNXMCLO01-AGR3-06 +\'%20and%20PhysicalSlot%20=%200%20and%20PhysicalPort%20=%200)%20or%20 +(TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeName%20=%20\'TTTNXMCLO01-AG +R3-06\'%20AND%20PhysicalSlot%20=%200%20and%20PhysicalPort%20=%200%20A +ND%20(AlertGroup%20IN%20(\'ReachabilityProblem\',%20\'component%20unr +eachable\',\'ER%20CEth%20Inalcanzable\')%20OR%20AlertGroup%20%20LIKE% +20\'[Pp]ower\'))%20or%20((TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeNa +me%20=%20\'CTLNXMCUO10-DIST1-09\'%20%20and%20PhysicalSlot%20=%2001%20 +and%20PhysicalPort%20=%2017%20)%20or%20(TMX_NodeName%20!=%20\'\'%20an +d%20TMX_NodeName%20=%20\'CTLNXMCUO10-DIST1-09\'%20%20and%20PhysicalSl +ot%20=%2009%20and%20PhysicalPort%20=%202%20)%20)%20or%20(TMX_NodeName +%20=%20\'CTLNXMCUO10-DIST1-09\'%20and%20PhysicalSlot%20=%2001%20and%2 +0PhysicalPort%20=%200)%20or%20(TMX_NodeName%20=%20\'CTLNXMCUO10-DIST1 +-09\'%20and%20PhysicalSlot%20=%2009%20and%20PhysicalPort%20=%200)%20o +r%20(TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeName%20=%20\'CTLNXMCUO1 +0-DIST1-09\'%20AND%20PhysicalSlot%20=%200%20and%20PhysicalPort%20=%20 +0%20AND%20(AlertGroup%20IN%20(\'ReachabilityProblem\',%20\'component% +20unreachable\',\'ER%20CEth%20Inalcanzable\')%20OR%20AlertGroup%20%20 +LIKE%20\'[Pp]ower\'))%20or%20((TMX_NodeName%20!=%20\'\'%20and%20TMX_N +odeName%20=%20\'CTLNXMCU10W\'%20and%20PhysicalSlot%20=%200%20and%20Ph +ysicalPort%20=%201)%20or%20(TMX_NodeName%20!=%20\'\'%20and%20TMX_Node +Name%20=%20\'CTLNXMCU10W\'%20and%20PhysicalSlot%20=%200%20and%20Physi +calPort%20=%202)%20or%20(TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeNam +e%20=%20\'CTLNXMCU10W\'%20and%20PhysicalSlot%20=%200%20and%20Physical +Port%20=%205)%20or%20(TMX_NodeName%20!=%20\'\'%20and%20TMX_NodeName%2 +0=%20\'CTLNXMCU10W\'%20and%20PhysicalPort%20=%200))&transientname=C02 +-2003-0263&viewname=Default_TMX&viewtype=system&datasource=NCOMS,NCOM +S2', 'C02-2003-0260_SINREFERENCIA' => 'https://10.94.249.177:1631 +1/ibm/console/webtop/AELView?sql=Serial%3C0&transientname=C02-2003-02 +60_SINREFERENCIA&viewname=Default_TMX&viewtype=system&datasource=NCOM +S,NCOMS2' };

    First key is processed succesfully, but second not...

      Thanks for this sample input. Before going any further I should just mention that passing raw SQL in a query string like this sets off all sorts of security Klaxons. Hopefully you are already aware of this and have taken all appropriate countermeasures.

      How do you know the second key is not processed? Are you viewing the results in a browser? If so, by the time the second key is reached your browser may have already refreshed and taken you to the URL in the first value at which point the rest of the script's output will be unseen.

      Did you run my SSCCE and determine for yourself that it processes the template inside the loop multiple times successfully?


      🦛

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-25 06:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found