in reply to Display Database table with CGI and HTML::Template
In other words, don't do html in the sub, just have the sub initialize another template and then return the template output or the template object.my $ht = new HTML::Template(filename=>'main.tmpl'); my $db_data=print(); $ht->params(db_data=>$db_data,%stuff); print $ht->output; sub print() { my $ht = new HTML::Template(filename=>'database_info.tmpl'); @foo=$dbh->do("select * from *"); # ok so it's not even vaugely lega +l. do yer own db code $ht->params(dbstuff=>@foo); return $ht->output; #probably not optimal }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Display Database table with CGI and HTML::Template
by orkysoft (Friar) on Oct 29, 2003 at 22:44 UTC |