I'm having some trouble sending the appropriate parameters to HTML::Template.
I have a module fetching the data from a DB, as follows:

EDIT: I have verified that the data exists on the databas, and is in the format I'm expecting

sub get_account { my $acct_num = pop; my $ar = $dbh->selectall_arrayref( 'SELECT * FROM account WHERE acco +unt_number = ?', { Slice => {} }, $acct_num ); my ($account) = @$ar; $account->{transactions} = \{get_transactions($account->{transaction +s_id})}; $account->{owners} = get_owners( $account->{customers_id} ); return $account; } sub get_transactions { my $transactions_id = shift; my $sql = <<'EOSQL'; SELECT s.transaction_date, type.name, s.amount, s.new_balance FROM transactions t JOIN single_transaction s ON t.single_transaction_id = s.id JOIN transaction_type type ON s.transaction_type_id = type.id WHERE t.id = ? EOSQL my $ar = $dbh->selectall_arrayref( $sql, undef, $transactions_id ); my @lines; my $count = 1; my %transac; for ( @$ar ) { my ($key, $type, $amount, $new_balance) = @$_; $key =~ /\A(\d{4})-(\d{2})-(\d{2})/; my $date = "$3\/$2\/$1"; my @line = ($count, $date, $type, $amount, $new_balance); $transac{$key} = \@line; $count++; } return \%transac; }

And the CGI part:

my $template = HTML::Template->new( filename => 'atm_choose.tmpl', die +_on_bad_params => 0 ); my $account_number = param( 'account_number' ); my $account = MyDB->get_account( $account_number ); $template->param( %$account ); print header, $template->output;

I'm having trouble with setting the transactions in $account->{transactions}. When set as a reference to anon hash, I have an ISA problem, when set as an anon hash, HTML Template complains I'm attempting to set the parameter as a scalar.
I attempted de-referencing the hash, but to no avail.

thank you.

UPDATE 31.03.2013
There seem to be far more bugs than expected in the code, I'm going to start this from scratch.

J -

In reply to Trouble with CGI / HTML::Template by jms53

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.