Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'd like to add my humble 2 cents here:
I've came from a HTML background so this node really drew my attention. I think that although is possible to do a clean separation of presentation and logic, sometimes it's not the best way to do it, because you end up messing with the readability of the page. Let me clarify this with a (silly) example: Let's say that a user of your web system should see a red background if he/she has a "0" level or a blue background if he/she has a "1" level. So, you could do this in two different ways (i'm coding this in a freely, lazy way so dont evaluate my code, this is just an example): First way (separating logic and presentation): Second way (mixing logic and presentation): The advantage of the second way in my point of view is that you don't need to go all the way up to understand what $bgcolor means and why it have this or that value, so the code is more easily understandable and more practical to debug. That's why I think separation should be avoided unless you are not used to deal with HTML. As I've stated before, this is just my humble opinion. UPDATE: Quick explanation: I've never used a Templating system with Perl, so I can't really give my opinion on that, but I've just tried to show the best way ***for me*** to code my pages =:c) Best regards,
my
($author_nickname, $author_email) = ("DaWolf","erabbott\@terra.com.br")
if ($author_name eq "Er
Galvão Abbott");
In reply to Re: Code and html separation - always or mostly doable?
by DaWolf
|
|