in reply to Best practices: Generating HTML content
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Best practices: Generating HTML content
by Dallaylaen (Chaplain) on Dec 24, 2017 at 15:31 UTC | |
by Your Mother (Archbishop) on Dec 24, 2017 at 16:50 UTC | |
by 1nickt (Canon) on Dec 24, 2017 at 17:35 UTC | |
by Dallaylaen (Chaplain) on Dec 24, 2017 at 18:03 UTC |