HTML::Template actually can do it either way. The benefit of building the output in a variable as you go along is that if you detect some sort of error, you can display an appropriate error page since you haven't sent anything to the browser yet. The benefit of printing straight out to the browser is that it requires less memory. Of course, with HTML::Template, you usually build your variables before associating them with the template so you could actually do your error checking there.
In HTML::Template, you can print straight out to the browser using $template->output(print_to => *STDIN). Note that TMPL_LOOPs are actually built into a variable prior to being dumped out regardless. If you want TMPL_LOOPs to dump straight out, I actually covered this in a meditation, among other things.
Hope this helps.
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
In reply to Re: Output HTML while(), or add to string while(), then output?
by antirice
in thread Output HTML while(), or add to string while(), then output?
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |