in reply to Getting data ready for HTML::Template
The first thing I noticed is that in one loop in the template, you've got three tokens all with the same name, so they'd get the same data.
In your for loop in Perl, and in the template loop, give each of them different names (key1, key2, key3, or hopefully something more meaningful).
You're also pushing to the array (in other words, making a row to display) once per hash key - you actually want one row per machine.
This is entirely untested code, but give this a try. Set the template tokens to match your data's keys (key1,key2,key3), and try this loop.
for $user ( keys %HoH ) { for $machine ( sort keys %{ $HoH{$user} } ) { %row_data = (); $row_data{MACHINE} = $machine; for my $key ( sort keys %{ $HoH{$user}->{$machine} } ) { $row_data{$key} = $HoH{$user}->{$machine}->{$key}; } push @{$loop_data}, \%row_data; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Getting data ready for HTML::Template
by gctaylor1 (Hermit) on Nov 18, 2009 at 22:01 UTC | |
by jethro (Monsignor) on Nov 18, 2009 at 22:37 UTC | |
by gctaylor1 (Hermit) on Nov 19, 2009 at 02:33 UTC | |
by hornet (Initiate) on Dec 04, 2009 at 18:02 UTC | |
by gctaylor1 (Hermit) on Dec 04, 2009 at 21:25 UTC | |
by afoken (Chancellor) on Dec 05, 2009 at 13:29 UTC | |
by Unforgiven (Hermit) on Nov 19, 2009 at 14:37 UTC |
In Section
Seekers of Perl Wisdom