Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Changing data structure with HTML::Template

by gryphon (Abbot)
on Feb 06, 2014 at 21:04 UTC ( #1073765=note: print w/replies, xml ) Need Help??

in reply to Changing data structure with HTML::Template

Greetings jms53,

I think you'll need to change your data structure. HTML::Template expects to iterate through hashrefs in an array rather than arrayrefs.

$account->{transactions} = [ map { { line => $_ } } @transactions ]; push @transactions, { date => $date, type => $type, amount => $amount, balance => $new_balance };

Replies are listed 'Best First'.
Re^2: Changing data structure with HTML::Template
by jms53 (Monk) on Feb 07, 2014 at 11:51 UTC
    Thank you gryphon,

    I updated my code as you showed, and the page now loads. However, the html sent to the browser doesn't contain any data for the table.

    <table border="1"> <tbody><tr> <td></td><td>Date</td><td>Type</td><td>Amount</td><td>Balance</ +td> </tr> <tr><td>Transaction:</td> </tr> </tbody></table>

    What I'm supposed to be seeing is more something along the lines of :

    I have debugged the data to confirm it exists (my first project I was deleting my data on the first run, and then all subsequent runs yielded 0 results), and I'm not getting any complaints from the server. If you have any ideas, they are most welcome :)

    J -

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2023-03-25 16:44 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (63 votes). Check out past polls.