Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
IMHO, I'm not a big fan of having my perl code mixed with HTML code. When I really began seperating my logic (perl code) from my presentation code (HTML and the template language), my web-based apps became infinitely simpler to maintain, and develop. To get this seperation I use HTML::Template. With this module, you can alternate the colors for each row of data, all from within the template. Here's a simple example that will alternate between two colors inside a template:
(Of course, in the a real-world this would contain more HTML code, but I didn't want to clutter the example) Then I'd use the following code to load the template, loop through the rows, print the results, and alternate the colors on each iteration:
Now, you could do this inside perl code, but I really believe that when you begin to include things other than perl code inside your perl scripts, they become less maintainable, and less elegant. In reply to (dkubb) Re: (2) alternating row colors
by dkubb
|
|