<div dir="ltr">I am going out of my mind. I have no idea what could be wrong.<div><br></div><div>Below is my route (with the hash defined in it), my html and the results I get in the browser.</div><div><br></div><div>get '/results' => sub {<br> <br> # Test the hash<br> my %season= (<br> 'TylerMontgomery(2022)' => {<br> 'so' => 1,<br> 'bb' => 1,<br> 'rbis' => 0,<br> 'atbats' => 117,<br> 'runs' => 2,<br> 'hits' => 2<br> },<br> 'ChaseLangan(2022)' => {<br> 'runs' => 4,<br> 'hits' => 24,<br> 'atbats' => 5,<br> 'bb' => 0,<br> 'rbis' => 2,<br> 'so' => 1<br> },<br> 'BryceJones(2021)' => {<br> 'hits' => 2,<br> 'runs' => 2,<br> 'atbats' => 4,<br> 'bb' => 2,<br> 'rbis' => 4,<br> 'so' => 1<br> },<br> );<br><br> <br> template '<a href="http://results.tt">results.tt</a>' => {<br> <br> 'title' => 'Get Softball Season Stats',<br> 'payload' => \%season,<br> <br> }, {};<br><br>};<br></div><div><br></div><div>################################################</div><div>HTML</div><div>################################################</div><div><!DOCTYPE html><br><html lang="en"><br> <head><br> <!-- head definitions go here --><br> <meta charset="utf-8"> <br> </head><br> <body><br> <br> <% IF payload.size %> <!-- season data --------------------------------------><br> <% payload.size %><br> <% USE Dumper; Dumper.dump(payload) %><br> <br> <div class="container" style="margin-top:20px;"><br> <h3>Trying with Gabor's solution</h3> <br> <% FOR name IN payload.keys.sort %><br> <% name %><br> -------------<br> <%- FOR field IN payload.$name.keys.sort %><br> <p>Field: </p><% field %> : <% payload.$name.$field -%><br> <p>Field: </p><% field %> : <% payload.$name.atbats -%><br> <% END %><br> <% END %><br> </div><br> <br> <div class="container" style="margin-top:20px;"><br> <h3>Trying with Ikegami's solution</h3> <br> <% FOREACH id IN payload.keys %><br> <% season = payload.$id %><br> <p><% season.runs %></p><br> <p><% season.atbats %></p><br> <% END %><br> </div><br> <br> <br> <br><br> <div class="container" style="margin-top:20px;"><br> <% USE String %><br> <br> Name atbats so bb rbis hits runs<br> <% FOR name IN payload.keys.sort %><br> <% fname = String.new(name) -%><br> <% atbats = String.new(payload.$name.atbats) -%><br> <% so = String.new(payload.$name.so) -%><br> <% bb = String.new(payload.$<a href="http://name.bb">name.bb</a> ) -%><br> <% rbis = String.new(payload.$name.rbis) -%><br> <% hits = String.new(payload.$name.hits) -%><br> <% runs = String.new(payload.$name.runs) -%><br> <% fname.left(22) %> <% atbats.right(3) -%> <% so.right(3) -%> <% bb.right(3) -%> <% rbis.right(3) -%> <% hits.right(3) -%> <% runs.right(3) -%><br> <% END %><br> <% END %><br> </div><br> <br> <div class="container" style="margin-top:20px;"><br> <h3>Trying with Perlmonks solution</h3> <br> <% FOREACH brevet = payload %><br> brevet.key <% brevet.key %><br> brevet.val <% brevet.value %><br> brevet.$val.hits <% brevet.$value.atbats %><br> brevet.val.atbats <% brevet.value.runs %><br> brevet.val.dist <% brevet.value.hits %><br> <% END %><br> </div><br> </body><br></html><br><br></div><div>#######################################################</div><div>The results that appear in the browser</div><div>#######################################################</div><div><div class="gmail-container" style="color:rgb(51,51,51);font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px;margin-top:20px"><h3 style="font-family:sans-serif;margin:1.2em 0px 0.6em">Trying with Gabor's solution</h3>-------------<p style="line-height:1.5em;margin:1.6em 0px">Field:</p>:<p style="line-height:1.5em;margin:1.6em 0px">Field:</p>:</div><div class="gmail-container" style="color:rgb(51,51,51);font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px;margin-top:20px"><h3 style="font-family:sans-serif;margin:1.2em 0px 0.6em">Trying with Ikegami's solution</h3><p style="line-height:1.5em;margin:1.6em 0px"></p><p style="line-height:1.5em;margin:1.6em 0px"></p></div><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px"><br style="color:rgb(51,51,51);font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px"><div class="gmail-container" style="color:rgb(51,51,51);font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px;margin-top:20px">Name atbats so bb rbis hits runs</div><div class="gmail-container" style="color:rgb(51,51,51);font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px;margin-top:20px"><h3 style="font-family:sans-serif;margin:1.2em 0px 0.6em">Trying with Perlmonks solution</h3>HASH(0x17982b0) brevet.key brevet.val brevet.$val.hits brevet.val.atbats brevet.val.dist</div><div id="gmail-footer" style="clear:both;padding-top:2em;text-align:center;padding-right:160px;font-family:sans-serif;font-size:10px;color:rgb(51,51,51)">Powered by <a href="http://perldancer.org/" style="color:rgb(0,51,204)">Dancer2</a> 0.300004</div></div><div id="gmail-footer" style="text-align:left;clear:both;padding-top:2em;padding-right:160px;font-family:sans-serif;font-size:10px;color:rgb(51,51,51)">##############################################################################################</div><div id="gmail-footer" style="text-align:left;clear:both;padding-top:2em;padding-right:160px;font-family:sans-serif;color:rgb(51,51,51)"><i>If I replace 'payload' => \%season, with 'payload' => %season and restart my app with plackup bin/app.psgi then the results in the browser are:</i></div><div id="gmail-footer" style="text-align:left;clear:both;padding-top:2em;padding-right:160px;font-family:sans-serif;font-size:10px;color:rgb(51,51,51)"><span style="font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px;background-color:rgb(221,221,221)">TylerMontgomery(2022) </span><span style="font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px;background-color:rgb(221,221,221)">TylerMontgomery(2022)</span><div class="gmail-container" style="font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px;margin-top:20px"><h3 style="font-family:sans-serif;margin:1.2em 0px 0.6em">Trying with Gabor's solution</h3>TylerMontgomery(2022) ------------- TylerMontgomery(2022)<p style="line-height:1.5em;margin:1.6em 0px">Field:</p>: TylerMontgomery(2022)<p style="line-height:1.5em;margin:1.6em 0px">Field:</p>: TylerMontgomery(2022)</div><div class="gmail-container" style="font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px;margin-top:20px"><h3 style="font-family:sans-serif;margin:1.2em 0px 0.6em">Trying with Ikegami's solution</h3>TylerMontgomery(2022) TylerMontgomery(2022)<p style="line-height:1.5em;margin:1.6em 0px"></p><p style="line-height:1.5em;margin:1.6em 0px"></p></div><br style="font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px"><br style="font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px"><div class="gmail-container" style="font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px;margin-top:20px">Name atbats so bb rbis hits runs TylerMontgomery(2022)</div><div class="gmail-container" style="font-family:"Lucida Grande","Bitstream Vera Sans",Verdana;font-size:13px;margin-top:20px"><h3 style="font-family:sans-serif;margin:1.2em 0px 0.6em">Trying with Perlmonks solution</h3>TylerMontgomery(2022) brevet.key brevet.val brevet.$val.hits brevet.val.atbats brevet.val.dist</div><div id="gmail-footer" style="clear:both;padding-top:2em;text-align:center;padding-right:160px">Powered by <a href="http://perldancer.org/" style="color:rgb(0,51,204)">Dancer2</a> 0.300004</div></div><div id="gmail-footer" style="clear:both;padding-top:2em;text-align:center;padding-right:160px;font-family:sans-serif;font-size:10px;color:rgb(51,51,51)"><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El dom., 23 ago. 2020 a las 23:11, Gabor Szabo (<<a href="mailto:gabor@szabgab.com">gabor@szabgab.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Try putting that backslash back so it will be<br></div><div><br></div><div> template '<a href="http://results.tt" rel="noreferrer" target="_blank">results.tt</a>' => {<br>
<br>
'title' => 'Get Softball Season Stats',<br>
'payload' => \%season,<br>
<br>
}, {};<br>
</div>Gabor<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Aug 23, 2020 at 10:44 PM Richard Reina <<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I was merely passing it as with different var name to distinguish from<br>
different attempts in my html. Taking out the other case, as I have<br>
done, has no effect on the results.<br>
<br>
This is what is being passed the html in the paste above:<br>
<br>
template '<a href="http://results.tt" rel="noreferrer" target="_blank">results.tt</a>' => {<br>
<br>
'title' => 'Get Softball Season Stats',<br>
'payload' => %season,<br>
<br>
}, {};<br>
<br>
And this is the result:<br>
<br>
<br>
Trying with payload<br>
TylerMontgomery(2022) ------------- TylerMontgomery(2022) :<br>
TylerMontgomery(2022)<br>
<br>
Name atbats so bb rbis hits runs TylerMontgomery(2022)<br>
<br>
<br>
2020-08-23 14:22 GMT-05:00, Gabor Szabo <<a href="mailto:gabor@szabgab.com" target="_blank">gabor@szabgab.com</a>>:<br>
> OK, so I don't understand why do you pass the same %payload 3 times, but<br>
> you need to pass references in all 3 cases.<br>
><br>
> template '<a href="http://results.tt" rel="noreferrer" target="_blank">results.tt</a>' => {<br>
> 'title' => 'Get Softball Season Stats',<br>
> 'games' => \%season,<br>
> 'season' => \%season,<br>
> 'payload' => \%season,<br>
> 'F_NAME' => 'Geraldo',<br>
><br>
><br>
> }, {};<br>
><br>
> On Sun, Aug 23, 2020 at 9:38 PM Richard Reina <<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>> wrote:<br>
><br>
>> template '<a href="http://results.tt" rel="noreferrer" target="_blank">results.tt</a>' => {<br>
>><br>
>> 'title' => 'Get Softball Season Stats',<br>
>> 'payload' => \%season,<br>
>><br>
>> }, {};<br>
>><br>
>> Results in this:<br>
>><br>
>> Trying with payload<br>
>> ------------- :<br>
>><br>
>> Name atbats so bb rbis hits runs<br>
>><br>
>><br>
>><br>
>> 2020-08-23 12:53 GMT-05:00, Gabor Szabo <<a href="mailto:gabor@szabgab.com" target="_blank">gabor@szabgab.com</a>>:<br>
>> > I think you should be passing references:<br>
>> ><br>
>> > 'payload' => \%season,<br>
>> ><br>
>> > See the backslash.<br>
>> ><br>
>> > Gabor<br>
>> ><br>
>> ><br>
>> ><br>
>> > On Sun, Aug 23, 2020 at 8:45 PM Richard Reina <<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>><br>
>> wrote:<br>
>> ><br>
>> >> Ok, maybe I've overlooked something but here is what I get with very<br>
>> >> simple call to a route and using very simple html.<br>
>> >><br>
>> >> <a href="http://paste.scsys.co.uk/592477" rel="noreferrer" target="_blank">http://paste.scsys.co.uk/592477</a><br>
>> >><br><br>
</blockquote></div></div>
</blockquote></div>