Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use HTML::Template; use Data::Dumper; use File::Slurp; # Load Main Template my $data_tmpl = HTML::Template->new(filename => 'data.tmpl',); my $more_data = more_data(); my $alldata; while ( my ( $key, $entry ) = each %{ $more_data } ) { # Load into the template $data_tmpl->param( NAME => $entry->{'NAME'}, ); # load values into template $data_tmpl->param( NUMBER => $entry->{NUMBER}, DATE => $entry->{DATE}, COL => $entry->{COL}, FIRST => $entry->{FIRST}, LAST => $entry->{NAME}, ); $alldata .= $data_tmpl->output; # Uses file slurp for writing write_file("/location/".$key.".html", $alldata); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Template output to files.
by Anonymous Monk on Apr 28, 2014 at 19:23 UTC | |
by Anonymous Monk on Apr 28, 2014 at 19:29 UTC | |
by Anonymous Monk on Apr 28, 2014 at 19:48 UTC | |
by Anonymous Monk on Apr 28, 2014 at 20:20 UTC | |
by Anonymous Monk on Apr 28, 2014 at 20:58 UTC | |
by Anonymous Monk on Apr 28, 2014 at 21:56 UTC |