in reply to Re^3: HTML::Template output to files.
in thread HTML::Template output to files.
If you can provide a sample of your data that would help in giving a precise answer (use Data::Dumper; print Dumper($more_data);). In addition, try some things out yourself and post here if you have questions about the code. I think the general concept would be something like this:
while ( my ($key,$name) = get_key_and_name() ) { my @data; while ( my ($entry) = get_data_for_key($key) ) { push @data, { NUMBER => $entry->{NUMBER}, etc=>"etc" }; } my $data_tmpl = HTML::Template->new(filename => 'data.tmpl'); $data_tmpl->param(NAME => $name, DATA => \@data); write_file("/location/$key.html", $data_tmpl->output); }
(once again untested and based only on the docs - just trying to show the concept of nested while loops here)
Without knowing what $more_data looks like, I can't say what the placeholders get_key_and_name() and get_data_for_key() should look like.
|
|---|