See your thread from earlier this month where several Monks recommended that you use templates to separate your HTML from your Perl code.
If I really really need sinppets of HTML in my program for some reason (e.g. because I am avoiding using a JavaSCript framework on the front end), I still use Template to generate them, so the raw HTML is kept apart. In such a case you would have the code you showed in its own something.tt template file, that would be processed with output stored in a reference to a scalar variable. The technique is somewhat convoluted as you wind up with a number of template files, so naming them sensibly and storing them in a logical file structure is important, but for me it's worth it since I don't like to feel dirty.
In reply to Re: Best practices: Generating HTML content
by 1nickt
in thread Best practices: Generating HTML content
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |