Re: html template loops (hash of a hash)

Karen <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
On 8/30/06, Covert, Jake (JSC.) <[email protected]> wrote:
> Don't think this is a Perl error, so I'm thinking it's an HTML::Template
> error, maybe.

Yep, it's actually a Perl error.  It's complaining about
"@{$vendor_hoh{$vendor}}" in line 85:

>  85         my ($rif, $rif_out, $graph, $raw, $percent1, $percent2, $percent3)
> = @{$vendor_hoh{$vendor}};

Whatever's in $vender_hoh{$vendor}, it's not an arrayref.  The problem
is earlier in your code.

Once %vendor_hoh is populated correctly, your code should work fine,
though you could shorten it thus (assuming I haven't made any
brainos):

$tmpl->param( TMPL_LOOP,
    [   map {
            rif          => $vendor_hoh{$_}->[0],
                rif_out  => $vendor_hoh{$_}->[1],
                graph    => $vendor_hoh{$_}->[2],
                raw      => $vendor_hoh{$_}->[3],
                percent1 => $vendor_hoh{$_}->[4],
                percent2 => $vendor_hoh{$_}->[5],
                percent3 => $vendor_hoh{$_}->[6],
        },
        sort keys %vender_hoh
    ]
);

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.